docker 模式下 unbutu中mysql的配置

1.sudo apt-get mysql-server -y

2.查看进程:ps aux|grep mysqld

3.修改配置文件,让外部链接可以访问:vim /etc/mysql/mysql.conf.d/mysqld.cnf (docker下 apt-get install vim)

找到 bind-address,改成0.0.0.0

4.保存后,sudo service mysql restart

5.权限设置

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY'root' WITH GRANT OPTION;(mysql8.0 会有语法错误)

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;

6.刷新权限:flush privileges;

7.查看本地IP ifconfig(docker 下 apt-get install net-tools)

你可能感兴趣的:(docker 模式下 unbutu中mysql的配置)