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

HTML table markup tutorial (28): cell border color attribute BORDERCOLOR

To beautify the table, you can set different bord...

React Router V6 Updates

Table of contents ReactRouterV6 Changes 1. <Sw...

MySQL cleverly uses sum, case and when to optimize statistical queries

I was recently working on a project at the compan...

Basic Implementation of AOP Programming in JavaScript

Introduction to AOP The main function of AOP (Asp...

Improvement experience and sharing of 163 mailbox login box interactive design

I saw in the LOFTER competition that it was mentio...

Completely uninstall mysql. Personal test!

Cleanly uninstall MySQL. Personally tested, this ...

Detailed explanation of the new background properties in CSS3

Previously, we knew several attributes of backgro...

MySQL View Principle Analysis

Table of contents Updatable Views Performance of ...

Steps to create a CentOS container through Docker

Table of contents Preface Create a bridge network...

MySQL 5.7.23 installation and configuration method graphic tutorial

This article records the installation tutorial of...

What kinds of MYSQL connection queries do you know?

Preface If the query information comes from multi...

Example of stars for CSS rating effect

What? What star coat? Well, let’s look at the pic...

Steps to package and release the Vue project

Table of contents 1. Transition from development ...

Detailed explanation of Grid layout and Flex layout of display in CSS3

Gird layout has some similarities with Flex layou...