Linux下允许MySQL 授权远程连接

1、mysql -u root -p   (root)用户名

2、mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

3、mysql>flush privileges;

4、如果此时还无法连接,检测配置文件(/etc/mysql/mysql.conf.d/mysqld.cnf) bind-address配置是否开启,应该是关闭

#bind-address = 127.0.0.1 注释掉;

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1                    <----这个
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8

5、重启mysql:/etc/init.d/mysql restart;

原文地址:https://www.cnblogs.com/weigege/p/8820221.html