docker pull mysql --platform linux/x86_64
docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:latest
docker cp mysql:/etc/mysql /Users/tanli/Downloads/docker
#!/bin/sh
docker run
-p 3306:3306
–name mysql
–privileged=true
–restart unless-stopped
-v /Users/tanli/Downloads/docker/mysql:/etc/mysql
-v /Users/tanli/Downloads/docker/mysql/logs:/logs
-v /Users/tanli/Downloads/docker/mysql/data:/var/lib/mysql
-v /etc/localtime:/etc/localtime
-e MYSQL_ROOT_PASSWORD=123456
-d mysql:latest
CREATE USER tanli
@127.0.0.1
IDENTIFIED WITH mysql_native_password BY ‘123456’;
GRANT Alter, Alter Routine, Create, Create Routine, Create Temporary Tables, Create User, Create View, Delete, Drop, Event, Execute, File, Grant Option, Index, Insert, Lock Tables, Process, References, Reload, Replication Client, Replication Slave, Select, Show Databases, Show View, Shutdown, Super, Trigger, Update ON . TO tanli
@127.0.0.1
;