Linux下配置mysql远程访问

1 编辑mysql的配置文件 mysqld.cnf

root@iZwz99xkrnh5xye3zgi4btZ:~# vi /etc/mysql/mysql.conf.d/mysqld.cnf

2 把  bind-address = 127.0.0.1 注释掉

3 重启 root@iZwz99xkrnh5xye3zgi4btZ:~# sudo /etc/init.d/mysql restart

4 进入mysql,输入给root用户设置权限的命令行并回车

mysql> grant all privileges on *.* to root@"%" identified by "123321" with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;

原文地址:https://www.cnblogs.com/qq605490312/p/7792082.html