阿里云中docker安装mysql配置Nacvicat连接
docker pull mysql:5.7
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=yourPassword mysql:5.7
//本地测试连接mysql
docker images #获取mysql的id
docker exec -it f921ee773684 /bin/bash #进入到容器
t.jpg
#设置其它用户可连接
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql>FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user from user;
+-------------------------+------+
| host | user |
+-------------------------+------+
| % | root |
| 127.0.0.1 | root |
| iz2ze3hkpeilimy9kn68tvz | |
| iz2ze3hkpeilimy9kn68tvz | root |
| localhost | |
| localhost | root |
+-------------------------+------+
6 rows in set (0.00 sec)
F.jpg
网友评论