编程知识 cdmana.com

docker pull mysql

  • Deploy mysql Default pull the latest version
docker pull mysql 
  • Mount Directory  
docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql

docker exec -it mysql bash

cd /etc/mysql/mysql.conf.d/mysqld.cnf

docker cp  mysql:/etc/mysql/mysql.conf.d/mysqld.cnf  xxxx  Hang in the directory 
  • Run script
docker run -d -p 3306:3306 --privileged=true -v /usr/local/docker/mysql/data:/var/lib/mysql -v /usr/local/docker/mysql/conf/my.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf -e MYSQL_ROOT_PASSWORD=123456  --name mysql mysql
  • Into the container
Docker exec -it mysql bash

mysql -u root -p

### mysql 8  Encryption changes  localhost 

 Create user 

alter user 'test'@'%' identified with mysql_native_password ;

// Set the password 

alter user 'test'@'%' identified with mysql_native_password by '1111';

版权声明
本文为[red red]所创,转载请带上原文链接,感谢

Scroll to Top