MAC電腦docker容器中啓動mysql

docker下載鏡像

docker pull mysql
docker imagesmysql

建立容器

docker run -d -e MYSQL\_ROOT\_PASSWORD=root --name mysql -v /usr/local/docker\_mysql/conf:/etc/mysql/conf.d -v /usr/local/docker\_mysql/data/mysql:/var/lib/mysql -p 3306:3306 mysql --character-set-server=utf8mb4 --collation-server=utf8mb4\_unicode\_ci --lower\_case\_table\_names=1sql

docker exec -it mysql bashdocker

若是鏈接Docker啓動的mysql出現報錯:

ERROR 2059 (HY000): Authentication plugin caching_sha2_password’ cannot be loadedbash

解決辦法

`ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';code

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';server

SELECT plugin FROM mysql.user WHERE User = 'root';`ci

中止

docker stop mysqlunicode

啓動

docker start msyqlit

相關文章
相關標籤/搜索