呃嗯需要两步
- 修改权限
// 修改权限 (注意这里用户名和密码替换成自己的)
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
//更新缓存
FLUSH PRIVILEGES;
- 修改配置
vi /etc/mysql/mysql.conf.d/mysqld.cnf
找到如下这一行,注释掉
bind-address = 127.0.0.1 //即前面加上#
然后
# 走你
service mysql restart