In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to deal with the problems encountered in upgrading the Docker mysql container to mysql8. The article is very detailed and has a certain reference value. Interested friends must finish reading it!
Problem reduction
The original mysql container creation command is as follows
Docker run-- name mysql-v / xxxx/xxx/mysqldata:/var/lib/mysql-p xxx:3306-d mysql:laster
The data directory was mounted under / xxxx/xxx/mysqldata and the leader asked me to upgrade mysql. I naively put down the latest mysql:8.0.11
Mysql mirroring then executes
Docker run-- name mysql-v / xxxx/xxx/mysqldata:/var/lib/mysql-p xxx:3306-d mysql:8.0.11
Create the container and mount it to the original directory: / xxxx/xxx/mysqldata
As a result, the container can't get up to view the log in a second.
Docker logs-f-t-- tail 70 mysql
The log says that the plug-in file under / xxxx/xxx/mysqldata was created by version 5.7. then I switched back to the original mysql:laster image creation container and said that the files in this directory could not be started by 8.0 modification. I felt that the directory was so useless that the old image could not be started and the new one could not be started.
So I cried foolishly by my own behavior. Do not directly use the new image to start the container and connect the original mysql directory. Some colleagues say this is fine, but why is there something wrong with me? is there a problem?
Solution:
Connect to the backup directory of / xxxx/xxx/mysqldata with the old mysql:laster image, backup is too important. Start a mysql container
Start a new mysql container with the new mysql:8.0.11 and hook up an arbitrary directory. Then restore the old data backup to the new mysql container through other tools such as navicat. Or by order.
$docker exec some-mysql sh-c 'exec mysqldump-- all-databases-uroot-p "$MYSQL_ROOT_PASSWORD" > / some/path/on/your/host/all-databases.sql backup restore.
1. If your new mysql is restored successfully, you use the navicate tool to connect and report the following errors
Then you need to modify the my.cnf file of mysql:
Add:
Default_authentication_plugin=mysql_native_password
Because 8.0 uses caching_sha2_password
You can enter the container:
Docker exec-it mysql / bin/bashmysql-uroot-pxxxxuse mysqlselect Host,User,plugin from mysql.user
Check out the following figure
Why do I have to change caching_sha2_password to mysql_native_password? I don't know, but after my 8.0.11 mysql container starts, the program interface still fails to report an error: unable to connect unsupported authentication methods, at this time you may need to upgrade the mysql driver of the program interface, but don't bother to upgrade, you can only change caching_sha2_password to mysql_native_password as a result, you can connect normally.
3. Record a little docker command.
Copying files from the heavy container to the host does not require the container to start the docker cp container: / etc/mysql/my.cnf / home/xxx/my.cnf copy the files of the host under the directory inside the container will overwrite the old file docker cp / home/xxx/my.cnf container: / etc/mysql/ if you use root to connect to the account in the program, you may also need to create a 'root' @'% 'account and modify its permissions for remote access Modify the command online to find all the contents of the article "how to deal with the problems encountered in upgrading Docker mysql containers to mysql8". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 240
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.