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
推薦:《mysql影片教學》
以上是MAC電腦docker容器中啟動mysql的方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!