mysql 5.7 2003 cant connect to mysql server on 10061 unknown error

mysql 5.7 2003 cant connect to mysql server on 10061 unknown error

navicat for mysql 远程连接数据库时出现2003-Can’t connect to Mysql on ‘主机名’(10061)解决方法

授权远程连接mysql方法:

grant all privileges on *.* to '用户名' identified by '密码';
flush privileges;
如果你用的是mysql8,那么需要创建新用户进行授权,直接用root授权报错;

mysql8授权远程连接请点击

因此需要修改mysql配置文件

步骤:

cat /etc/mysql/my.cnf

输出以下:

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

所以进入/etc/mysql/mysql.conf.d/ 修改

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

(3)将bind-address = 127.0.0.1修改为bind-address = 0.0.0.0

(4)保存退出

(5)sudo service mysql restart (一定要重启数据库,不然没用)

ok,此时就可以远程连接此数据库了.

posted @ 2021-08-18 14:34  Micheal_L  阅读(229)  评论(0编辑  收藏  举报