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

Detailed steps to install MySQL on CentOS 7

In CentOS7, when we install MySQL, MariaDB will b...

mysql 8.0.19 win10 quick installation tutorial

This tutorial shares the installation tutorial of...

CSS method of controlling element height from bottom to top and from top to bottom

Let’s start the discussion from a common question...

JavaScript Basics Operators

Table of contents 1. Operators Summarize 1. Opera...

CSS3 uses var() and calc() functions to achieve animation effects

Preview knowledge points. Animation Frames Backgr...

Vue uses el-table to dynamically merge columns and rows

This article example shares the specific code of ...

MySQL cursor principle and usage example analysis

This article uses examples to explain the princip...

Zen coding resource update function enhancement

Official website: http://code.google.com/p/zen-cod...

Detailed explanation of MySQL user rights verification and management methods

This article uses examples to illustrate how to v...

Idea deploys remote Docker and configures the file

1. Modify the Linux server docker configuration f...

Sample code for implementing dark mode with CSS variables

Recently, WeChat was forced by Apple to develop a...

How to smoothly upgrade and rollback Nginx version in 1 minute

Today, let's talk about a situation that is o...

Detailed process of installing Presto and connecting Hive in Docker

1. Introduction Presto is an open source distribu...