Minimal upgrade of MySql 5.6 to 8.0 on windows

Please pay attention to backing up the database source data before starting!!! That is, the data folder.
Please pay attention to backing up the database source data before starting!!! That is, the data folder.
Please pay attention to backing up the database source data before starting!!! That is, the data folder.

1. Download the package of mysql 8.0

  • For offline installation, it is recommended to download the zip compressed package (decompress, use the administrator command line to configure)
    official website address: https://dev.mysql.com/downloads/mysql/

  • Use the installation package (double-click to install, select the required components, automatically download and install, configure)
    official website address: https://dev.mysql.com/downloads/installer/

2. Configure a new database after decompressing in zip mode

  1. Open cmd or powershell in management mode
    mysqld --initialize-insecure --user=root
    
  2. Wait for the execution to complete, it will take a while
    to create files such as the data folder
  3. Create an installer service
    mysqld install
    
  4. start service
    net start mysql
    
    or (sc can be used directly in cmd, and sc.exe should be used in powershell)
    sc.exe start mysql
    
  5. Root administrator login (the default password is blank)
    mysql -u root
    

3. The zip method is upgraded from 5.6 to 8.0

This method requires two zip packages, one is the zip package of the 5.7 intermediate version, and the other is the zip package of the target version 8.0.
The reason is: According to practice, version 8.0 does not support direct upgrade from mysql version lower than 5.7 to version 8.0.
1. It is recommended to execute the following commands directly through the administrator command line/powershell
2. Assume that your database is started as a service, and service namemysql

1. First step

Upgrade from 5.6 to 5.7:
1) Stop the mysql service
mysqladmin -uroot -p shutdownor manually close 2) Unzip the 5.7 zip package to the source 5.6 directory and completely overwrite it 3) Start the mysql service net stop mysql4 ) Execute the upgrade program of 5.7 If the root user has a password, You also need to add parameter 5) If no error is reported, the upgrade from 5.6 to 5.7 is completesc stop mysql


mysql_upgrade -uroot
-p

2. The second step

Upgrade from version 5.7 to version 8.0, the upgrade document on the official website
1) Close the service
mysqladmin -uroot -p shutdownor net stop mysqlor sc stop mysqlmanually close
2) Unzip the compressed package of 8.0 and overwrite all the files in 5.7 before
3) Start the service
4) Wait for the startup to complete.
Versions after 8.0.16 are in During the process of starting the service, it will automatically upgrade and update relevant data;
otherwise, you need to execute mysql_upgrade
5) If it starts normally, the upgrade is complete; if you do not refer to the error information in the relevant err file, make adjustments.

Fourth, the problem record in the process

  1. The authentication plugin caching_sha2_password
    has changed the password encryption rules since 8.0 ( mysql_native_password-> caching_sha2_password)
    to use the original password method:
    alter user root@localhost identified with mysql_native_password by "root";

  2. Unsupported redo log format (0). The redo log was created before MySQL 5.7.9

  3. Cannot upgrade server earlier than 5.7 to 8.0
    These two problems can be solved through a solution:
    Since my old version is 5.6, I cannot directly update from 5.6 to 8.0, so according to the prompt, update the 5.6 version to the 5.7 version first, and then Just update from 5.7 to 8.0.

  4. When specifying the address of my.ini,
    attention should be paid to the compatibility of the configuration items. If the configuration items are incompatible, the service will fail to start; the
    error information can be found in the bin directory of the err file log of the mysqld error. The error message is modified, usually directly commented out.

Guess you like

Origin blog.csdn.net/downanddusk/article/details/125867307