• notice
  • Congratulations on the launch of the Sought Tech site

Mysql-8.0.11-winx64.zip installation tutorial explanation

Download the zip installation package:

  MySQL8.0 For Windows zip package download address: https://dev.mysql.com/downloads/file/?id=476233, it is not necessary to log in after entering the page.Then click "No thanks, just start my download." at the bottom to start downloading.

   or download directly: https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.11-winx64.zip

Environment: Windows 10

One, install

  1.1, unzip the zip package to the installation directory

   For example, my installation directory is: C:\Program Files\MySQL

  1.2, configuration file

   In Windows systems, the configuration file defaults to the my.ini file (or my-default.ini) in the installation directory.Some configurations need to be configured during the initial installation, and most of them can also be changed after the installation is complete.Of course, in extreme cases, everything can be changed.

   We found that there is no my.ini file in the unzipped directory, so you can create it yourself.Add my.ini in the installation root directory, for example, here is: C:\Program Files\MySQL\my.ini, write basic configuration:

# Set 3306 port
# Set mysql installation directory
basedir=C:\Program Files\MySQL
# Set the storage directory of mysql database data
# Allow the maximum number of connections
# Allow the number of connection failures.This is to prevent someone from trying to attack the database system from this host
# The character set used by the server is UTF8 by default
# The default storage engine that will be used when creating a new table
# Use "mysql_native_password" plug-in authentication by default
# Set the default character set of the mysql client
# Set the port used by default when the mysql client connects to the server

Attention, basedir inside is my local installation directory, datadir is the location where my database data files should be stored, and various configurations need to be configured according to your own environment.

To view all configuration items, please refer to: https://dev.mysql.com/doc/refman/8.0/en/mysqld-option-tables.html

  1.3, initialize the database

Execute the command in the bin directory of the MySQL installation directory:

mysqld --initialize --console

After the execution is complete, the initial default password of the root user will be printed, such as:

C:\Users\Administrator>cd C:\Program Files\MySQL\bin
C:\Program Files\MySQL\bin>mysqld --initialize --console
2018-04-28T15:57:17.087519Z 0 [System] [MY-013169] [Server] C:\Program Files\MySQL\bin\mysqld.exe (mysqld 8.0.11) initializing of server in progress as process 4984
2018-04-28T15:57:24.859249Z 5 [Note] [MY-010454] [Server] A temporary password is generated for [email protected]: rI5rvf5x5G,E
2018-04-28T15:57:27.106660Z 0 [System] [MY-013170] [Server] C:\Program Files\MySQL\bin\mysqld.exe (mysqld 8.0.11) initializing of server has completed
C:\Program Files\MySQL\bin>

  Attention! There is a paragraph in the execution output: [Note] [MY-010454] [Server] A temporary password is generated for [email protected]: rI5rvf5x5G,E where "rI5rvf5x5G,E" after [email protected]: is the initial password (without the first digit) Spaces).Before you change the password, you need to remember this password, and you need to use it for subsequent logins.

   If your hands are low, the closing is fast, or you don’t remember, that’s okay.Delete the initialized datadir directory and execute the initialization command again, and it will be regenerated.Of course, you can also use security tools to force the password to be changed.You can do whatever you want.

Reference: https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization-mysqld.html

  1.4, installation service

Execute the command in the bin directory of the MySQL installation directory (open the cmd command line as an administrator, or Shift+right click in the installation directory to "open the command line window here"):

mysqld --install [service name]

The service name after

can be omitted, and the default name is mysql.Of course, if you need to install multiple MySQL services on your computer, you can use different names to distinguish them, such as mysql5 and mysql8.

After the installation is complete, you can start the MySQL service through the command net start mysql.


C:\Program Files\MySQL\bin>mysqld --install
Service successfully installed.
C:\Program Files\MySQL\bin>net start mysql

MySQL service is starting..

The MySQL service has been started successfully.

C:\Program Files\MySQL\bin>

Reference: https://dev.mysql.com/doc/refman/8.0/en/windows-start-service.html

 Second, change password and password authentication plugin

  Execute the command in the bin directory of the MySQL installation directory:

mysql -u root -p

   At this time, you will be prompted to enter the password.Remember the password during the installation in step 1.3 above, fill in it to log in successfully and enter the MySQL command mode.

Before MySQL8.0.4, execute

SET PASSWORD=PASSWORD('[modified password]');

You can change the password, but starting from MySQL 8.0.4, this default is not enough.Because before, the MySQL password authentication plug-in was "mysql_native_password", but now it uses "caching_sha2_password".

  Because there are currently many database tools and link packages that do not support "caching_sha2_password", for convenience, I temporarily changed back to "mysql_native_password" authentication plugin.

Modify the user password, execute the command in MySQL:

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

Modify the password verification plug-in, and modify the password at the same time.

   If you want to use the "mysql_native_password" plug-in authentication by default, you can configure the default_authentication_plugin item in the configuration file.



C:\Program Files\MySQL\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.Commands end with; or \g.
Your MySQL connection id is 8
Server version: 8.0.11
Copyright (c) 2000, 2018, Oracle and/or its affiliates.All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates.Other names may be trademarks of their respective
Type'help;' or'\h' for help.Type'\c' to clear the current input statement.
mysql> ALTER USER'root'@'localhost' IDENTIFIED WITH mysql_native_password BY'new password';
Query OK, 0 rows affected (0.06 sec)

Reference: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password

   At this point, the installation and deployment is complete.The official said that the test speed of MySQL8 is twice as fast as 5.

  You can use the command to check the database installed by default:

show databases;
use mysql;
show tables;
mysql> show databases;
| Database |
| information_schema |
| mysql |
| performance_schema |
| sys |
4 rows in set (0.01 sec)

See that the mysql database is initialized by default, and the MySQL user information is stored in the user table.We can take a look at the default MySQL user:

select user,host,authentication_string from mysql.user;

mysql> select user,host,authentication_string from mysql.user;
+------------------+-----------+------------------ -------------------------+
| user | host | authentication_string |
+------------------+-----------+------------------ -------------------------+
| root | localhost | *27C237A977F4F44D3F551F1A673BE14DFD232961 |
+------------------+-----------+------------------ -------------------------+
4 rows in set (0.00 sec)

The host of the administrator root is localhost, which means that only localhost login access is allowed.If you want to allow other ip logins, you need to add a new host.If you want to allow all ip access, you can directly modify it to "%"

Create user:

CREATE USER'xxh'@'%' IDENTIFIED WITH mysql_native_password BY'xxh123!@#';
#(Note: the mysql8.0 encryption method has been modified)
#Check users
select user, host, plugin, authentication_string from user\G;
Authorize remote database
#Authorize all permissions
#Authorize basic query and modify permissions, set according to needs

View user permissions

show grants for'xxh'@'%';


mysql> use mysql;
Database changed
mysql> CREATE USER'xxh'@'%' IDENTIFIED WITH mysql_native_password BY'xxh123!@#'; #Create user (note: mysql8.0 encryption method has been modified)
Query OK, 0 rows affected (0.07 sec)

Check the password encryption method:

mysql> select user, host, plugin, authentication_string from user;
+------------------+-----------+------------------ -----+-------------------------------------------+
| user | host | plugin | authentication_string |
+------------------+-----------+------------------ -----+-------------------------------------------+
| xxh |% | mysql_native_password | *70FD6FB4F675E08FF785A754755B5EBA6DA62851 |
| mysql.infoschema | localhost | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| mysql.session | localhost | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| mysql.sys | localhost | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| root | localhost | mysql_native_password | *27C237A977F4F44D3F551F1A673BE14DFD232961 |
+------------------+-----------+------------------ -----+-------------------------------------------+
5 rows in set (0.00 sec)

   In addition, if you need to add a new account, or someone other than this machine accesses MySQL, you also need to set the host of the built-in account


The above is a detailed explanation of the mysql-8.0.11-winx64.zip installation tutorial introduced by the editor.I hope it will be helpful to you.If you have any questions, please leave a message to me.The editor will reply to you in time.!


Technical otaku

Sought technology together

Related Topic


Leave a Reply