1.修改MySQL配置文件(/etc/MySQL/my.cnf),注釋以下行:
#bind-address = 127.0.0.1 2.重啟MySQL數據庫,對於Ubuntu系統,執行如下命令
sudo /etc/init.d/mysql restart 3.以root用戶登錄MySQL後,執行如下命令:
grant all privileges on *.* to root@’允許登錄的遠程機器ip’
identifIEd by ‘密碼’ 其中,*.*表示該主機中所有數據庫的所有表。(數據庫.表)
“給某IP地址上登錄的root用戶授予訪問所有數據庫中的所有表的所有權限”
mysql -u root -pvmwaremysql>use MySQL;
MySQL>update user set host = '%' where user = 'root';
MySQL>select host, user from user;
grant all privileges on *.* to user
[email=user@ip]@ip[/email]
identifIEd by "passWord";
flush privileges;
exit MySQL>use MySQL;
MySQL>UPDATE user SET Password=PASSWORD('new_passWord') WHERE user='USER';
MySQL>FLUSH PRIVILEGES;
MySQL>GRANT ALL ON YOUDB.* TO USER@IP or DOMAINNAME
IDENTIFIED BY 'PASSWORD'; grant all privileges on *.* to user@ip identifIEd by "passWord";
flush privileges;
exit