docker pull mysql
docker run --name mysql -itd -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root1234 mysql
docker exec -it mysql /bin/bash
mysql -uroot -p
注意:远程绑定navicat需要授权,别忘记刷新
ALTER user ‘root‘@‘%‘ IDENTIFIED WITH mysql_native_password BY ‘root1234‘;
FLUSH PRIVILEGES;
退出到主机exit exit
如果连不上要注意防火墙开放端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
查看自己ip:ip a
原文地址:https://www.cnblogs.com/oo-llm/p/12075601.html
时间: 2024-10-10 04:17:22