Docker deployment mysql8

1. Pull the image

docker pull mysql:8.0.28

2. Start the container

docker run -d --name mysql -p 23306:3306 -e MYSQL_ROOT_PASSWORD=Abcd@2023! mysql:8.0.28 --lower_case_table_names=1

3. Change password (backup)

  1. into the container

    docker exec -it mysql bash
    
  2. authentication

    mysql -uroot -p123456
    use mysql
    
  3. change Password

    ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '新密码'
    
  4. Refresh permissions

    flush privileges
    

4. Synchronize time

docker cp /usr/share/zoneinfo/Asia/Shanghai mysql:/etc/localtime

5. Too Many Connections

SHOW VARIABLES LIKE 'max_connections';


SET GLOBAL max_connections=1000;
SET GLOBAL wait_timeout=300;

Guess you like

Origin blog.csdn.net/qq_35921773/article/details/129201687