mysql 8. 0.11 winx64. zip installation tutorial details

  • 2021-10-25 00:03:31
  • OfStack

Download the zip installation package:

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

Or download it directly: https://dev.mysql.com/get/Downloads/MySQL-8. 0/mysql-8. 0.11-winx64. zip

Environment: Windows 10

1. Installation

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 system, the configuration file is my. ini file (or my-default. ini) in the installation directory by default. Some configurations need to be configured during initial installation, and most of them can be changed after installation. Of course, in extreme cases, everything can be changed.

We found that there is no my. ini file in the extracted directory, so it doesn't matter if you can create it yourself. Add my. ini to the installation root, as I have here: C:\ Program Files\ MySQL\ my.ini, and write to the basic configuration:


[mysqld]
#  Settings 3306 Port 
port=3306
#  Settings mysql Installation directory of 
basedir=C:\Program Files\MySQL
#  Settings mysql The storage directory of the data in the database 
datadir=E:\database\MySQL\Data
#  Maximum number of connections allowed 
max_connections=200
#  The number of connection failures allowed. This is to prevent an attempt to attack the database system from this host 
max_connect_errors=10
#  The character set used by the server defaults to UTF8
character-set-server=utf8
#  Default storage engine to be used when creating new tables 
default-storage-engine=INNODB
#  Default uses " mysql_native_password "Plug-in authentication 
default_authentication_plugin=mysql_native_password
[mysql]
#  Settings mysql Client default character set 
default-character-set=utf8
[client]
#  Settings mysql The default port used when the client connects to the server 
port=3306
default-character-set=utf8

Note that basedir is my local installation directory, and datadir is the location where my database data files should be stored. All configurations need to be configured according to my own environment.

For 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 under the bin directory of the MySQL installation directory:

mysqld --initialize --console

When the execution is complete, the initial default password of the root user is 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 root@localhost: 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 one paragraph in the execution output: [Note] [MY-010454] [Server] A temporary password is generated for root @ localhost: rI5rvf5x5G, where root @ localhost: The following "rI5rvf, E" is the initial password (excluding the first space). Before changing the password, you need to remember this password, which is needed for subsequent login.

If your hands are cheap, close fast, or don't remember, it's okay. Delete the initialized datadir directory, 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, and you can use any method at will.

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

1.4. Installation of Services

Execute the command in the bin directory of the MySQL installation directory (open the cmd command line as an administrator, or right-click "Open Command Line Window Here" in the Shift installation directory):

mysqld --install [服务名]

The following service name can be left unwritten, and the default name is mysql. Of course, if you need to install multiple MySQL services on your computer, you can distinguish them by different names, such as mysql5 and mysql8.

Once the installation is complete, you can start the service of MySQL with the command net start mysql.

Example:


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

The MySQL service is starting..

The MySQL service has started successfully.

C:\Program Files\MySQL\bin >

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

2. Change passwords and password authentication plug-ins

Execute the command under 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 in Step 1.3 above, fill it in and log in successfully, and enter MySQL command mode.

Prior to MySQL 8.0. 4, execute


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

You can change the password, but MySQL 8.0. 4 starts, so it doesn't work by default. Because before, the password authentication plug-in of MySQL was "mysql_native_password", but now it is "caching_sha2_password".

Because many database tools and link packages currently do not support "caching_sha2_password", I temporarily changed back to the "mysql_native_password" authentication plug-in for convenience.

Modify the user password and execute the command in MySQL:


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

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

If you want to use " mysql_native_password "Plug-in authentication, which can be configured in the configuration file default_authentication_plugin Item.


[mysqld]
default_authentication_plugin=mysql_native_password

Example:


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
owners.
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)
mysql>

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 are completed. Officials say the test speed MySQL8 is twice as fast as 5.

You can view the database installed by default under 1 with the command:


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

See the default initialization of the mysql database, which user table inside the MySQL user information. We can look at 1 default MySQL user:


select user,host,authentication_string from mysql.user;

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

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

Create a user:


CREATE USER 'xxh'@'%' IDENTIFIED WITH mysql_native_password BY 'xxh123!@#';
#( It should be noted that: mysql8.0 The encryption method has been modified )
# Check users 
select user, host, plugin, authentication_string from user\G;
 Authorized remote database 
# Authorize all permissions  
GRANT ALL PRIVILEGES ON *.* TO 'xxh'@'%' ; 
# Authorize basic query and modification permissions, and set them according to requirements 
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON *.* TO 'xxh'@'%';

View User Permissions


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 root@localhost: 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>
0

Example:


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 root@localhost: 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>
1

View password encryption:


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 root@localhost: 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>
2

In addition, if you need to add a new account, or if someone outside this machine accesses MySQL, you also need to set up host with built-in account

Summarize

The above is the site to introduce you mysql-8. 0.11-winx64. zip installation tutorial details, I hope to help you, if you have any questions welcome to leave me a message, this site will reply to you in time!


Related articles: