首页 > 技术文章 > ubuntu下mysql开放远程访问

gyyyl 2021-01-07 20:21 原文

GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; //123456是你自己的密码
这样以后可以在
use mysql;
select user,host from user where user='root';
看到
root %
root localhost

此时还不能够远程访问,还需要修改配置文件
在/etc/mysql/mysql.conf.d/下面有个文件mysqld.cnf
将里面的
bind-address=127.0.0.1注释掉就可以了

推荐阅读