个人博客:打开链接
第一步:
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
在打开文件后,在文件中找到:bind-address = 127.0.0.1这一行,然后注释掉这一行。
然后重启mysql:
service mysql restart
第二步:
注:[一定要先登录进数据库]
mysql -uroot -ppassword
进入数据库后运行如下命名:
grant all privileges on . to root@”%” identified by “password” with grant option;
flush privileges; //很必要,刷新权限信息