82855 AI Apple Watch CentOS Eclipse H700 iCal iOS iPad iPhone iphone4 iTunes Java Javascript linux Mac MBP ML MySQL Oracle Parallels Desktop RAID redmine Rocky Linux RockyLinux screen Snow Leopard SQL SVN Thinkpad VMware VR Windows Windows 7 Windows 11 Word X40 东航 字体 导航 数据库 朗逸 签证 达美 闹钟

给 MySQL 的 root 用户赋予或取消权限


[HOWTO] Grant and Revoke Remote root Access to MySQL
To grant root access from all hosts (except for localhost):

GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'topsecret';

To revoke root access from all hosts (except for localhost):

DELETE FROM mysql.user WHERE User = 'root' AND Host = '%';
FLUSH PRIVILEGES;

To enable MySQL service to accept connections from all hosts change the following line in file mysql.conf:

bind-address=127.0.0.1

to

bind-address=0.0.0.0

or better just comment out:

#bind-address=127.0.0.1

and restart the MySQL service.

Notes:
*) The percent symbol (“%”) in the notation root@”%” means “any host”, but it doesn’t imply localhost. You need to repeat the commands above with root@localhost in order to grant/revoke permissions for localhost.

来源:http://ptankov.wordpress.com/2008/04/09/howto-grant-and-revoke-remote-root-access-to-mysql/