Mysql under ubuntu cannot connect remotely and reports an error of 10038

1. Environment

Ubuntu 16.04, mysql 5.7, navicat remote tool

2. After everything is installed, why can’t the remote control work? Is there anything else to configure?

(1.) Need to configure my.cnf

  Mysql looks for the configuration file order: /etc/mysql/my.cnf ----> /etc/my.cnf ---> /home/yourname/.my.cnf

  Copy /etc/mysql/mysql.conf.d/mysqld.conf to /etc/mysql/my.cnf and rename it to my.cnf

  Try it again with the navicat tool and still report an error. . .

 (2) Try modifying the configuration file

  Change bind-address = 127.0.0.1 to bind-address = 0.0.0.0 (indicating that any address can be accessed), after modifying ok, you need to restart mysql. Restart mysql command: sudo /etc/init.d/mysql restart

  It is still possible to report an error 10038.. . .

( I succeeded at this step! )

  (3) Log in to the mysql database on the Linux side : mysql -uuname -ppassword (the default root user cannot log in remotely)
  mysql> use mysql;
  query the host value:
  mysql> select user,host from user;


  If there is no host value of "%", execute the following two sentences:
  mysql> update user set host='%' where user='root';
  mysql> flush privileges;

  It is still possible to report an error 10038.. . .

(4) Let ubuntu's firewall allow port 3306 to go out

    sudo ufw allow 3306

    sudo ufw reload

(5) You should be able to log in to navicat.

Original address: https://www.cnblogs.com/L-Lune/p/8618190.html  Thanks to the author for sharing

Guess you like

Origin blog.csdn.net/liujibin1836591303/article/details/90480387