docker 创建mysql容器并且绑定到本地navicat
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