MySQL 8.X installation tutorial under Windows

MySQL 8.X installation tutorial under Windows

I had been using MySQL 5.7 before, but because MySQL added some new features, I chose to update.

Download MySQL

Go to the MySQL official website download address and select Windows (x86, 64-bit), ZIP Archive.

Download address: https://dev.mysql.com/downloads/mysql/

You can skip this step without logging in. The download process may be a little slow, please be patient.

After the download is complete, simply unzip it to your preferred location.

Uninstall the original version

If you have installed an earlier version of MySQL, you need to uninstall the previous version first. If you have not installed it, you can skip this step.

The administrator opens cmd, first stops the MySQL service with net stop mysql, and then uses mysqld remove MySQL to remove MySQL.

net stop mysql 
mysqld remove MySQL 

Delete the registry information to avoid the new version sometimes not being able to be installed normally. If there are any below, delete them, but when I was operating, only the first one existed.

HKEY_LOCAL_MACHINE/SYSTEM/ControlSet001/Services/Eventlog/Application/MySQL
HKEY_LOCAL_MACHINE/SYSTEM/ControlSet002/Services/Eventlog/Application/MySQL
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Eventlog/Application/MySQL 

Modify the original MySQL_HOME environment variable to point to the new version location.

Install MySQL

In the MySQL decompression directory, create a new data folder and create a my.ini configuration file.

[mysqld]
# Set port 3306 port=3306
# Set the installation directory of mysql basedir=E:\\tools\\MySQL\\mysql-8.0.18-winx64
# Set the storage directory of mysql database data datadir=E:\\tools\\MySQL\\mysql-8.0.18-winx64\\data
# Maximum number of connections allowed max_connections=3000
# The number of connection failures allowed. This is to prevent someone from trying to attack the database system from this host 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

[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 = 3306
# Set the default character set when the mysql client connects to the server default-character-set=utf8

Enter the bin directory and execute mysqld --initialize --console. A temporary password will be output if the execution is successful.

mysqld --initialize --console

After successful execution, the following output will be displayed: A temporary password is generated for root@localhost: a4lcly4e8f-G
a4lcly4e8f-G is the temporary password 

Then you can use the password and if you are lucky, you can log into MySQL normally.

Login error

If unfortunately, an error occurs when logging in using a temporary password, ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES).

If you encounter this problem, you need to skip the password verification.

First stop the MySQL service: net stop mysql

In the bin directory of the MySQL installation path, enter mysqld --console --skip-grant-tables --shared-memory. The cmd window will be suspended, that is, it looks stuck. Don't worry, this is normal.

Then open another window, the same as the bin directory of the MySQL installation path, directly enter mysql, and then execute use mysql.

Run flush privileges to refresh permissions, and then run alter user'root'@'localhost' IDENTIFIED BY '1234'; to change the password.

To be on the safe side, use the flush privileges command again to refresh the permissions.

Close the window and reconnect to MySQL using the password you just entered: mysql -u root -p, and then enter the password again. If it shows that the service is not started, you need to start the MySQL service first, enter net start mysql.

# Shut down MySQL
net stop mysql

# Skip permission checkmysqld --console --skip-grant-tables --shared-memory

# flush privileges

# Connect to MySQL in --skip-grant-tables mode
mysql

# Use the system mysql library use mysql

# Change password alter user 'root'@'localhost' IDENTIFIED BY '1234';

# flush privileges

# Connect to MySQL. The space after -u and -p can be omitted. You don't need to enter a password after -p. Press Enter and then enter the password. This is safer. mysql -u root -p 1234

# Exit MySQL
\q
exit
quit

Summarize

The above is the installation tutorial of MySQL 8.X under Windows introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor 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:
  • MySQL 8.0.18 installation tutorial under Windows (illustration)
  • Steps for installing MySQL 8.0.16 on Windows and solutions to errors
  • MySQL 8.0.16 installation and configuration tutorial under Windows 10
  • MySQL 8.0.16 installation and configuration method graphic tutorial under Windows
  • MySQL 8.0.13 free installation version configuration tutorial under Windows environment
  • MySQL installation tutorial under Windows with pictures and text
  • MySQL 8.0.11 Installation Tutorial under Windows
  • mysql8.0 windows x64 zip package installation and configuration tutorial
  • MySQL 8.0.11 Community Green Edition Installation Steps Diagram for Windows
  • MySQL5.7.17 winx64 installation version configuration method graphic tutorial under Windows server 2008 r2
  • Windows system mysql5.7.18 installation graphic tutorial
  • Detailed tutorial for installing mysql5.7.21 under Windows

<<:  Tutorial on installing Tomcat server under Windows

>>:  How to use TypeScript in Vue

Recommend

JavaScript anti-shake and throttling detailed explanation

Table of contents Debounce Throttle Summarize Deb...

JS quickly master ES6 class usage

1. How to construct? Let's review the common ...

Disadvantages and reasonable use of MySQL database index

Table of contents Proper use of indexes 1. Disadv...

MYSQL string forced conversion method example

Preface Since the types of the same fields in the...

How to use Javascript to generate smooth curves

Table of contents Preface Introduction to Bezier ...

Tutorial on how to deploy LNMP and enable HTTPS service

What is LNMP: Linux+Nginx+Mysql+(php-fpm,php-mysq...

Trash-Cli: Command-line Recycle Bin Tool on Linux

I believe everyone is familiar with the trashcan,...

Docker image compression and optimization operations

The reason why Docker is so popular nowadays is m...

Install Linux using VMware virtual machine (CentOS7 image)

1. VMware download and install Link: https://www....

Web page creation for beginners: Learn to use HTML's hyperlink A tag

The hyperlink a tag represents a link point and i...

How to add rounded borders to div elements

As shown below: CSS CodeCopy content to clipboard...

How to Rename a Group of Files at Once on Linux

In Linux, we usually use the mv command to rename...

Analysis and solution of a MySQL slow log monitoring false alarm problem

Previously, for various reasons, some alarms were...

Analyzing the troublesome Aborted warning in MySQL through case studies

This article mainly introduces the relevant conte...