Detailed tutorial on installing different (two) versions of MySQL database on Windows

Detailed tutorial on installing different (two) versions of MySQL database on Windows

1. Cause:

I need to import a sql file, but I can't import it. When I execute this sentence, there is a problem. After some searching, it turns out that my database version (original MySQL version 5.5) is too low, and the version that supports this statement should be at least 5.7. So I went to the MySQL official website to download the latest version (8.0.15).

 `create_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP

2. Process:

So here comes the question: there are two solutions. 1. Uninstall the 5.5 version of MySQL and install the 8.0.15 version directly. 2. Continue to install the 8.0.15 version without uninstalling the 5.5 version. My choice is ******* (you should understand it by looking at the title)~

2.1 Download MySQL 8.0.15

https://dev.mysql.com/downloads/mysql/ Click the link to open the following webpage directly, select the Windows operating system, and download the zip pointed by the arrow.

2.2 Unzip MySQL 8.0.15

Unzip the downloaded compressed package.

The files in the folder are as follows (the data folder and my.ini file are not there when they are unzipped)

2.3 Create a new data folder and my.ini configuration file

data folder (empty is ok), add some parameters in my.ini.

[mysqld]
# Set port 3307 (the original mysql5 already occupies port 3306)
port=3307
# Set the installation directory of mysql (your own directory)
basedir=D:\mysql8\mysql-8.0.15-winx64
# Set the storage directory of mysql database data datadir=D:\mysql8\mysql-8.0.15-winx64\data
# Maximum number of connections allowed max_connections=200
# The number of connection failures allowed.
max_connect_errors=10
# The default character set used by the server is UTF8
character-set-server=utf8
# The default storage engine that will be used when creating a new table default-storage-engine=INNODB
#Default authentication is done with the "mysql_native_password" plugin #mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# Set the default character set of the mysql client to default-character-set=utf8
[client]
# Set the default port used by the mysql client to connect to the server port = 3307
default-character-set=utf8

2.4 Add environment variables

Change to your own Mysql8 path, to bin


2.5 Shut down the original mysql5 service

Right click on my computer - Manage - Services and Applications - Services - Stop MySQL service

2.6 Installation

①Open a black window (CMD) as an administrator, switch to the bin directory of the mysql8 installation directory and execute

mysqld --initialize --console

Notice! After the execution is completed, the output result contains a paragraph:

[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: XI5ovf,x5G,?

The "XI5ovf,x5G,?" after root@localhost: is the initial password (excluding the first space).

Before changing the password, you need to remember this password as it will be needed for the first login.

You can copy it to a text file and save it first.

②Execute in the bin directory

mysqld --install MYSQL8

MYSQL8 is the service name you choose. You can define the name yourself, as long as it is different from the original MySQL service.

③After the installation is complete, execute (your own service name)

net start mysql8==>啟動服務(net stop mysql8 is to stop the service, sc delete mysql8 is to delete the service)

3. Results

Enter mysql -uroot -P3307 -p (the password you just copied) in the console

(If you want to change the password, execute

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new password';)

Cheers! 8.0.15 was installed successfully! Then my sql was executed perfectly! Problem solved!

Summarize

The above is a detailed tutorial on how to install different (two) versions of MySQL database on Windows. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Install MySQL5.5 database in CentOS7 environment
  • Centos7 mysql database installation and configuration tutorial
  • Detailed tutorial on installing MySQL database in Linux environment
  • Detailed tutorial on installing MySQL 8.0.20 database on CentOS 7
  • How to install MySQL database on Ubuntu
  • Windows Server 2016 MySQL database installation and configuration detailed installation tutorial
  • Install two MySQL5.6.35 databases under win10
  • Introduction to MySQL database installation method and graphical management tool

<<:  Summary of uncommon operators and operators in js

>>:  Implementation example of nginx access control

Recommend

Coexistence of python2 and python3 under centos7 system

The first step is to check the version number and...

CSS3 flexible box flex to achieve three-column layout

As the title says: The height is known, the width...

Basic HTML directory problem (difference between relative path and absolute path)

Relative path - a directory path established based...

A brief analysis of mysql index

A database index is a data structure whose purpos...

Detailed explanation of overflow:auto usage

Before starting the main text, I will introduce s...

Mini Programs use Mini Program Cloud to implement WeChat payment functions

Table of contents 1. Open WeChat Pay 1.1 Affiliat...

Server stress testing concepts and methods (TPS/concurrency)

Table of contents 1 Indicators in stress testing ...

CSS flexible layout FLEX, media query and mobile click event implementation

flex layout Definition: The element of Flex layou...

MySQL data migration using MySQLdump command

The advantages of this solution are simplicity an...

How to install vim editor in Linux (Ubuntu 18.04)

You can go to the Ubuntu official website to down...

Solutions to Mysql index performance optimization problems

The optimization created by MySQL is to add index...

Example of MySQL auto-increment ID exhaustion

Display Definition ID When the auto-increment ID ...