操作容器的快乐,一般人都能体会到,没错你就是一般人。
docker search mysql
docker pull mysql:latest
docker images
port
:容器port
>/var/lib/mysql
>docker run --name mysql1 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -v /data/mysql:/var/lib/mysql -d mysql:latest
docker ps -a
/bin/bash
docker exec -i -t mysql1 /bin/bash
mysql -u root -p
use mysql
#查看当前加密方式
SELECT User,Host,plugin FROM user WHERE User='root';
#修改加密方式
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
#修改'root'为任何连接方式登录
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
#刷新权限
FLUSH PRIVILEGES;
show variables like 'character%';
set character_set_database = 'utf8';
set character_set_server = 'utf8';