docker mysql

docker pull mysql:8.0.16

------------------------------------------------------------------------------------------------------------------------------------------------

docker run \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=123456 \
-v /home/docker/mysql/conf:/etc/mysql/ \
-v /home/docker/mysql/data:/var/lib/mysql \
-v /home/docker/mysql/log:/var/log/mysql \
-v /home/docker/mysql/mysql-files:/var/lib/mysql-files/ \
--name mysql \
--restart=always \
-d mysql:8.0.16

------------------------------------------------------------------------------------------------------------------------------------------------

systemctl start restart stop status enable disable firewalld

firewall-cmd --version --help --state --reload

firewall-cmd --list-all

firewall-cmd --add-service=http

firewall-cmd --add-port=80/tcp 立马生效,但是重启后,失效

firewall-cmd --add-port=80/tcp --permanent 永久生效,需要 reload 重新加载

firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --reload

netstat -nlt
yum install -y net-tools;


select host,user,plugin from user;

caching_sha2_password mysql_native_password

create user 'ligy'@'%' identified with mysql_native_password by '123456';

alter user 'root'@'%' identified with mysql_native_password by '123456';

drop user 'ligy'@'%';

grant all privileges on *.* to 'ligy'@'%';

flush privileges;

 

posted on 2023-08-17 12:35  biind  阅读(22)  评论(0编辑  收藏  举报