docker-mysql-server-config
v0.0.1
Published
```bash sudo docker run --name=mysql1 -d -p 3306:3306 mysql/mysql-server:8.0 sudo docker stop mysql1 sudo docker start mysql1
Downloads
1
Readme
Docker MySQL Server Config
sudo docker run --name=mysql1 -d -p 3306:3306 mysql/mysql-server:8.0
sudo docker stop mysql1
sudo docker start mysql1
sudo docker logs mysql1 2>&1 | grep GENERATED
# GENERATED ROOT PASSWORD: Axegh3kAJyDLaRuBemecis&EShOs
sudo docker exec -it mysql1 mysql -uroot -p
# ...
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
# Query OK, 0 rows affected (2.21 sec)
UPDATE mysql.user SET plugin='caching_sha2_password' WHERE user='root';
# Query OK, 0 rows affected (0.01 sec)
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
CREATE USER 'root'@'%';
ALTER USER 'root'@'%' IDENTIFIED WITH caching_sha2_password BY 'password';
# OR
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
CREATE DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
exit
# backup db
sudo docker exec -it mysql1 mysqldump -u root -p test > db_test.sql
# enter password