Windows of x86 64bit Upgrade MySQL 5.7. 17 Installation Free Tutorial

  • 2021-07-01 08:27:02
  • OfStack

MySQL needs to be upgraded to 5.5. 3 or above to support the Laravel 5.4 default utf8mb64 character encoding. Therefore, I upgraded MySQL for 1 time, but I still encountered some minor problems, so I recorded it for reference.

Upgrade preparation

Back up the data directory (database directory) under the previous MySql directory. MySql official website downloads MySQL version 5.7. 17 compressed package. Run the command line as an administrator and enter the command net stop mysql to stop the mysql service. Enter the command sc delete mysql to delete the mysql service. Uninstall the current version of MySQL.

Start the upgrade

Extract the MySQL 5.7. 17 zip package into the corresponding directory (example: E:\ Software\ mysql-5. 7.17-winx64).

Configure

Copy my-default. ini to bin directory named my. ini (Copy directly to the root directory sometimes initializes with an error).

The my. ini file adds the following:


[mysqld]
basedir = E:\Software\mysql-5.7.17-winx64
datadir = E:\Software\mysql-5.7.17-winx64\data
port = 3306
default-character-set = utf8
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
[WinMySQLadmin]
Server = E:\Software\mysql-5.7.17-winx64\bin\mysqld.exe
user = root
password =
[client]
default-character-set = utf8

Note: sql_mode=NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES should be placed above [WinMySQLadmin] and client, otherwise an error will be reported. And the above paths need to be changed to unzipped directories.

Install services

Administrator identity command line, enter bin directory, enter mysqld-initialize command, initialize MySQL. Enter the mysqld-install command to install the MySQL service. Enter the command net start msyql to start M with SQL service. Enter the command mysql-h localhost-u root-p to log in to MySQL.

At this time, the password is required. MySQL 5.7. 17 initialization is to create a temporary password. After opening the err file named by the administrator name in the data directory, you can find the temporary password by looking at the first Note.


2017-02-12T07:22:42.516404Z 1 [Note] A temporary password is generated for root@localhost: RqfpPhxhJ0%a
After entering MySQL, enter alter user 'root' @ 'localhost' identified by 'New Password'; Set the password. Enter flush privileges; Refresh. Enter quit; Exit, and then you can log in to MySQL with your new password.

Import data

Open the data directory backed up before, and copy each database directory to the data directory of the new MySQL to use the previous databases.

Note: Due to the version problem, the data is incompatible and cannot be used, so it is necessary to check the official documents to solve it.


Related articles: