Change default_authentication_plugin for MySQL 8.0.18 in Docker container running on Red Hat Enterprise Linux:
You have just bring up the the MySQL 8.0.18 container and realized default_authentication_plugin is caching_sha2_password and not mysql_native_password. And would like to change, here are the steps
Identify Docker container using command docker ps -a:
#docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e5b5f47e87b7 mysql/mysql-server:8.0.18 "/entrypoint.sh mysq…" 4 days ago Up 4 days (healthy) 3306/tcp, 33060/tcp mysql_8.0.18_1
Change my.cnf file for container mysql_8.0.18_1:
Connect shelll access to MySQL container:
#docker exec -it <container_name> bash
#docker exec -it mysql_8.0.18_1 bash
At this point you will realized you don't vi editor so let us install it, it will install vim-minimal
#yum install vi
#vi /etc/my.cnf
Remove the comment from following line, save it and exit the file:
Before - #default-authentication-plugin=mysql_native_password
After - default-authentication-plugin=mysql_native_password
Restart Mysql docker container:
# docker restart mysql_8.0.18_1
Connect to MySQL docker and check the changes using mysql client inside docker:
# docker exec -it mysql_8.0.18_1 mysql -uroot -p
password:
mysql> show variables like default_authentication_plugin
+---------------------------------+-----------------------+
| Variable_name | Value |
+---------------------------------+-----------------------+
| default_authentication_plugin | mysql_native_password |
+---------------------------------+-----------------------+
You are all set to use mysql_native_password as a default_authentication_plugin.
You have just bring up the the MySQL 8.0.18 container and realized default_authentication_plugin is caching_sha2_password and not mysql_native_password. And would like to change, here are the steps
Identify Docker container using command docker ps -a:
#docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e5b5f47e87b7 mysql/mysql-server:8.0.18 "/entrypoint.sh mysq…" 4 days ago Up 4 days (healthy) 3306/tcp, 33060/tcp mysql_8.0.18_1
Change my.cnf file for container mysql_8.0.18_1:
Connect shelll access to MySQL container:
#docker exec -it <container_name> bash
#docker exec -it mysql_8.0.18_1 bash
At this point you will realized you don't vi editor so let us install it, it will install vim-minimal
#yum install vi
#vi /etc/my.cnf
Remove the comment from following line, save it and exit the file:
Before - #default-authentication-plugin=mysql_native_password
After - default-authentication-plugin=mysql_native_password
Restart Mysql docker container:
# docker restart mysql_8.0.18_1
Connect to MySQL docker and check the changes using mysql client inside docker:
# docker exec -it mysql_8.0.18_1 mysql -uroot -p
password:
mysql> show variables like default_authentication_plugin
+---------------------------------+-----------------------+
| Variable_name | Value |
+---------------------------------+-----------------------+
| default_authentication_plugin | mysql_native_password |
+---------------------------------+-----------------------+
You are all set to use mysql_native_password as a default_authentication_plugin.
Comments
Post a Comment