mysql

docker pull mysql
docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql

MySQL8.0登录提示caching_sha2_password问题解决方法
方式一:
配置 mysql.cnf 配置默认身份验证插件
[mysqld]
default_authentication_plugin = mysql_native_password
mysql -u root -p
SELECT Host, User, plugin from user;
方式二:
use mysql;
ALTER USER ‘root‘@‘%‘ IDENTIFIED WITH mysql_native_password BY ‘123456‘;
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘123456‘;
FLUSH PRIVILEGES;
SELECT Host, User, plugin from user;



docker run -d -p 3306:3306
-v /etc/mysql/my.cnf:/etc/mysql/conf.d/mysqld.cnf
-v /data/mysql/data:/var/lib/mysql
-e MYSQL_ROOT_PASSWORD=12345
--name mysql_test
mysql

相关推荐