Mysql-8.0.11-winx64.zip Installation Tutorials

Source: Internet
Author: User
Tags mysql client mysql create mysql create user server port

Download the ZIP installation package:

MySQL8.0 for Windows Zip package: https://dev.mysql.com/downloads/file/?id=476233, you can not log in after entering the page. After clicking on the bottom "No Thanks, just start my download." To start the download.

or direct download: 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, and some configurations need to be configured during initial installation, and most can be changed after the installation is complete. Of course, in extreme cases, everything can be changed.

We found that the extracted directory does not have a My.ini file, so it's okay to create it yourself. Add My.ini at the root of the installation, for example I am here: C:\Program Files\mysql\my.ini, write the basic configuration:

[mysqld]# Set 3306 ports Port=3306# Set up the MySQL installation directory Basedir=C:\Program files\mysql# Set the data storage directory for the MySQL database DataDir=e:\database\mysql\data# Maximum number of connections allowed Max_connections=200# Number of attempts to allow connection failures. This is to prevent someone from attempting to attack the database system from the host Max_connect_errors=10# The default character set used by the server is Utf8character-set-server=utf8# The default storage engine that will be used when creating a new table Default-storage-engine=INNODB[MySQL]# set MySQL client default character set Default-character-set=UTF8[Client]# The port that is used by default when MySQL client connects to server port is set=3306Default-character-set=utf8

Note that the inside of the Basedir is my local installation directory, DataDir is my database data files to be stored in the location, the configuration needs to be configured according to their own environment.

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

1.3, initializing the database

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

Mysqld--initialize--console

When execution is complete, the root user's initial default password is printed, such as:

c:\users\administrator>cd C:\Program files\mysql\binc:\program files\mysql\bin>mysqld--initialize- -consoleinprocess for [email protected]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 Completedc:\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

If your hands are cheap, close quickly, or don't remember, that's fine, delete the initialized DataDir directory, and then execute the initialization command again, and regenerate it. Of course, you can also use security tools, forced to change the password, with what method, their own discretion.

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

1.4, Installation 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 installation directory shift+):

mysqld--install [service name]

After the service name can not be written, the default name is MySQL. Of course, if you need to install more than one MySQL service on your computer, you can differentiate it with different names, such as MySQL5 and Mysql8.

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

Example:

C:\Program files\mysql\bin>mysqld--installservice successfully installed. C:\Program files\mysql\bin>net start mysqlmysql 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

Second, change password and password Authentication plugin

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

Mysql-u root-p
This time will prompt to enter the password, remember the above step 1.3 installation password, fill in can log in successfully, into the MySQL command mode.

Prior to MySQL8.0.4, the execution

SET Password=password (' [Modified password] ');
You can change the password, but the MySQL8.0.4 starts, so the default is no. Because before, MySQL's password authentication plug-in is "Mysql_native_password", and now uses "Caching_sha2_password".

Because there are many database Tools and link packages do not support "Caching_sha2_password", for convenience, I temporarily changed back to the "Mysql_native_password" Authentication plugin.

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 plugin and change 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 entry in the configuration file.

[Mysqld]
Default_authentication_plugin=mysql_native_password

Example:

C:\Program Files\mysql\bin>mysql-u Root-penter Password:************Welcome to the MySQL Monitor. CommandsEndWith , or \g.your MySQL connection ID is8Server Version:8.0.11Copyright (c)2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or Itsaffiliates. Other names trademarks of their respectiveowners. Type ' help; ' or ' \h ' forHelp . 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.06sec) MySQL>

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

Here, the installation deployment is complete. Officials say the test speed is MySQL8 twice times faster than 5.

You can use the command to view the default installed database:

show databases;

Use MySQL;

Show tables;

Mysql> show databases; +--------------------+| Database           |+--------------------+| information_schema | | mysql              | | performance_schema | | sys                 in Set (0.01 sec) MySQL>

See that the MySQL database is initialized by default, where the user table stores information about MySQL users. We can 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                     |+------------------+-----------+------------------------------- ------------+| Mysql.infoschema | localhost | *thisisnotavalidpasswordthatcanbeusedhere | | mysql.session |    localhost | *thisisnotavalidpasswordthatcanbeusedhere | | mysql.sys        | localhost | * Thisisnotavalidpasswordthatcanbeusedhere | | Root in              Set (0.00 sec) MySQL>

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

To create a user:

CREATE USER ' xxh ' @ '% ' identified with Mysql_native_password by ' [Email protected]# ';

# (need to note: mysql8.0 encryption method Modified)
#检查用户

Select User, host, plugin, authentication_string from user\g;

Authorizing a remote database

#授权所有权限
GRANT all privileges on * * to ' xxh ' @ '% ';
#授权基本的查询修改权限, set on demand
GRANT select,insert,update,delete,create,drop,alter on *. * to ' xxh ' @ '% ';

View User Permissions
Show grants for ' xxh ' @ '% ';

Example:

mysql> use mysql;database changedmysql> CREATE USER ' xxh ' @ '% ' identified with Mysql_native_password by ' [E Mail protected]# '; #创建用户 (Note: mysql8.0 encryption method Modified) Query OK, 0 rows affected (0.07 sec)
Mysql> 

To view password encryption methods:

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 rowsinchSet (0.00sec) MySQL>

In addition, if you need to add a new account, or other people outside the computer to access MySQL will also need to set up the built-in account host, for reference: MySQL create user and authorization

Mysql-8.0.11-winx64.zip Installation Tutorials

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.