1. docker + mysql

https://hub.docker.com/_/mysql/

  • 启动
docker run -p 3306:3306 --name mysql \
-v ~/mysql/conf:/etc/mysql \
-v ~/mysql/logs:/var/log/mysql \
-v ~/mysql/data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=123456 \
-d mysql:5.7.28
docker exec mysql whereis mysql
docker exec mysql ls /etc/mysql
docker cp mysql:/etc/mysql/my.cnf ~/mysql/conf/
  • 链接 mysql
docker exec -it mysql bash
mysql -uroot -p123456
use mysql
select user,authentication_string from user;
update user set authentication_string=''  where user='root';
alter user 'root'@'%' IDENTIFIED BY 'root@alsk1029';
alter user 'root'@'localhost' IDENTIFIED BY 'root@alsk1029';
flush privileges;
host: 127.0.0.1
port: 3306
user: root
password: 123456
  • 修改密码
docker exec -it mysql bash
mysqladmin -uroot -p123456 password 123
作者: 雪之梦技术驿站
链接: https://snowdreams1006.github.io/devops/docker-mysql.html
来源: 雪之梦技术驿站
本文原创发布于「雪之梦技术驿站」,转载请注明出处,谢谢合作!

https://snowdreams1006.github.io/snowdreams1006-wechat-open.png

© snowdreams1006 all right reserved,powered by Gitbook文件修订时间: 2020-04-08 10:06:52

results matching ""

    No results matching ""