background

Mysql-5.7 was installed on the old server, and the original var\lib\mysql folder exists in its entirety. Now you need to restore the original database.

Mysql installation

  • download
$ docker pull mysql:5.7.27
Copy the code
  • Start the

Start the Docker image on Windows (same with Linux)

$docker run - name mysql -p 3306:3306 - v e: / docker/mysql: / var/lib/mysql - e MYSQL_ROOT_PASSWORD = 123456 - d mysql: 5.7.27Copy the code
  • stop
$ docker stop mysql
Copy the code

The migration

The original var \ lib \ mysql in the different database (mysql, except performance_schema) folder to migrate to Windows E: / docker/mysql folder, at the same time will also move to E ibdata1 file: / docker/mysql, Restart the Docker image

$ docker start mysql
Copy the code

mysql8

Mysql8 requires all files to be copied and restarted.