#登陆mysql $ mysql -uroot -p mysql> use mysql; mysql> update user set host = '%' where user = 'root'; mysql> select host, user from user; +-----------+------------------+ | host | user | +-----------+------------------+ | % | root | | localhost | debian-sys-maint | | localhost | mysql.session | | localhost | mysql.sys | +-----------+------------------+ 4rows in the SET ( 0.00 sec) #ok exit to restart the service MySQL MySQL > quit; $ Service MySQL restart # find the remote client can not connect or continue to modify configuration files mysql.cnf # requires root privileges, the configuration file is read-only $ sudo vim /etc/mysql/mysql.conf.d/ mysqld.cnf # turned down, comment out this line, save and exit # the bind -address = 127.0 . 0.1 # to restart the service $ service MySQL restart; #ok it
https://www.cnblogs.com/wilwei/p/10244774.html