Docker mysql8 modify password

Docker mysql8 modify password

Set skip password login

docker exec -it mysql /bin/sh
# Note: The configuration file for editing is docker.cnf
vi /etc/mysql/conf.d/docker.cnf
exit

Restart MySQL container

docker restart mysql

Restart MySQL container

The old version of the command is invalid:
update user set password = password (‘a123456 ‘), where user =’root'</ s>
correct:

UPDATE mysql.user SET authentication_string='' WHERE user='root' and host='localhost';
-- Change the password for use without expiration
ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; 
flush privileges;

Error handling

ERROR 2059 (HY000): Authentication plugin ‘caching_ sha2_ password’ cannot be loaded: /usr/lib64/mysql/plugin/caching_ sha2_ password.so: cannot open shared object file: No such file or directory

Maybe the password is not set and will never expire. Maybe the database client version under Linux is too low. I tried to connect to mysql8 of docker in server B on server a, but the connection was successful by using DataGrid in windows.

Creating users and authorizations

create user  'nacos'@'%' identified by '123';
grant all on mid_nacos.* to 'nacos'@'localhost' ;
flush privileges;

Here, all the permissions of the table are granted, and all the items that can be authorized are explained and referenced https://www.cnblogs.com/yinzhengjie/p/10263692.html

Solve the error of operation create user failed for ‘user’ @ ‘%

It may be that the user already exists, you can delete and recreate it to
check whether the user exists: select user from user
delete: drop user 'user' @ '%

Solving com.mysql.cj.exceptions.unabletoconnectexception: public key retrieval is not allowed

Add & amp; after the connection information; allowPublicKeyRetrieval=true

Read More: