1. 运行SQL语句授权用户
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password'
2. 编辑/etc/mysql/my.cnf,把bind-address = 127.0.0.1
注释掉
3. 重启MySQL服务
service mysql restart
如果用户还需要拥有授权其他用户的权限,则需要用下面的命令(把%换成IP),用户要退出重新登录mysql才能生效:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' with grant option
评论