5.7版本数据库:
# 在宝塔终端用root账户登录mysql
mysql -u root -p
# 授权root用户对所有数据库在指定服务器ip可以进行操作,注意替换你的ip和root密码,可以使用内网ip
grant all on *.* to root@'172.19.11.180' identified by 'your_root_password' with grant option;
# 如果要授权root用户对所有数据库在任何ip都可以进行操作,将上面命令的ip改为`%`即可
grant all on *.* to root@'%' identified by 'your_root_password' with grant option;
# 刷新mysql缓存
flush privileges;

8.0 版本数据库:
use mysql;
update user set host='%' where user ='root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;
FLUSH PRIVILEGES;
4053

被折叠的 条评论
为什么被折叠?



