docker install mysql


获取镜像

  • docker pull mysql:latest

run

  • docker run --name mysql -d -p 3306:3306 -v //e/docker/data/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 mysql
  • docker run --name mysql -d -p 3306:3306 -v /Users/gecheng/files/docker/data/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 mysql

    Error response from daemon

git-bash尝试补全造成的问题。在path前加/可以实现跳过path的书写转义规定。


进入/退出容器

  • docker exec -it mysql bash
  • exit

进入/退出mysql

  • mysql -u root -p
  • exit

Authentication plugin ‘caching_sha2_password’ cannot be loaded

Mysql5.6以上的版本修改了Password算法,这里需要更新密码算法

1
2
3
mysql> ALTER user 'root'@'%' IDENTIFIED BY '123456' PASSWORD EXPIRE NEVER;
mysql> ALTER user 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
FLUSH PRIVILEGES;


  docker
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×