Linux下配置mysql远程访问

时间:2024-07-12 09:34:44

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

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

Linux下配置mysql远程访问

2 把  bind-address = 127.0.0.1 注释掉

Linux下配置mysql远程访问

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

Linux下配置mysql远程访问

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;

Linux下配置mysql远程访问