Home > Database > Mysql Tutorial > Upgrading the Docker installation of MySQL

Upgrading the Docker installation of MySQL

WBOY
Release: 2023-09-16 09:09:07
forward
805 people have browsed it

升级 MySQL 的 Docker 安装

Before upgrading your docker installation of MySQL, make sure to follow these steps -

  • Download the MySQL server docker image.

  • Start the MySQL server instance.

  • Connect to the MySQL server instance from within the container.

Here are the steps to upgrade a Docker installation of MySQL 5.7 to 8.0 -

  • Stop the MySQL 5.6 server using the following command. Here mysql56 is the name of the container.

docker stop mysql56
Copy after login
  • Download the MySQL 5.7 Server Docker image.

  • Start new MySQL 5.7 Docker container data and configuration.

  • Modify as needed.

  • If a MySQL community server exists, run the following command -

docker run --name=mysql57 \
--mount type=bind,src=/path-on-host-machine/my.cnf,dst=/etc/my.cnf \
--mount type=bind,src=/path-on-host-machine/datadir,dst=/var/lib/mysql \
-d mysql/mysql-server:5.7
Copy after login
  • If necessary, change mysql/mysql- server adjusted to the correct repository name.

  • Wait for the server to complete the startup operation.

  • You can use the "docker ps" command to check the status of the server.

  • Run the mysql_upgrade utility in the MySQL 5.7 Server container using the following command -

docker exec -it mysql57 mysql_upgrade -uroot -p
Copy after login
  • When prompted, Enter the root password of the old MySQL 5.6 server.

  • Complete the upgrade by restarting MySQL 5.7 server container using the following command -

docker restart mysql57
Copy after login

The above is the detailed content of Upgrading the Docker installation of MySQL. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template