MAC电脑docker容器中启动mysql的方法
导读
docker下载镜像
docker pull mysql docker images
创建容器
docker run -d -e MYSQL_ROOT_PASSWORD=root --name mysql57 -v /usr/local/docker_mysql/57/data/mysql:/var/lib/mysql -p 3306:3306 mysql --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --lower_case_table_names=1 docker exec -it mysql57 bash
如果连接Docker启动的mysql出现报错:
ERROR 2059 (HY000): Authentication plugin caching_sha2_password’ cannot be loaded
解决办法
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root'; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; SELECT plugin FROM mysql.user WHERE User = 'root';
停止
docker stop mysql
启动
docker start msyql
评论(0)