Mysql-mysql 8.0.11 Installation Tutorial

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

There are a lot of tutorials on the web, basically similar. However, installing the software may sometimes fail because of a detail installation. I have also integrated a number of tutorials to install, so this tutorial may not be universally suitable.

Installation Environment: Win7

1. 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.

2. Installation

2.1 Unzip the ZIP package to the installation directory

My decompression is in the E:\software\mysql\mysql-8.0.11-winx64.

Extracted Files Directory

2.2 Configuring Environment variables

Add the bin path under the Decompression folder to the value of the variable, before and after; Beginning End

2.3 Configuring the Initialized My.ini file

We found that the extracted directory does not have a My.ini file, so it's okay to create it yourself. Under Install root, add My.ini (Create a new text file, change the file type to. ini), and write to the basic configuration:

[Mysqld]#Set 3306 Portport=3306#set up the installation directory for MySQLbasedir=e:\\software\\mysql\\mysql-8.0.11-Winx64 # Remember to use double slash \ \, single Slash I'll make a mistake here, but look at other people's tutorials, there are some single slash. Try it yourself.#set up the data storage directory for the MySQL databasedatadir=e:\\software\\mysql\\mysql-8.0.11-Winx64\\data # here ditto#Maximum number of connections allowedmax_connections=200#the number of times the connection was allowed to fail. This is to prevent someone from attempting to attack the database system from the hostmax_connect_errors=10#the character set used by the service side defaults to UTF8Character-set-server=UTF8#default storage engine that will be used when creating a new tableDefault-storage-engine=INNODB#default to use "Mysql_native_password" Plugin authenticationdefault_authentication_plugin=Mysql_native_password[mysql]#set the MySQL client default character setdefault-character-set=Utf8[client]#set the default port to use when MySQL client connects to the serverport=3306default-character-set=utf8

Note: The data directory does not need to be created, and is created automatically in the next initialization work.

3. Install MySQL

When installing, you must run CMD as an administrator, or you will get an error when installing, which will cause the installation to fail.

3.1 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-- console2018-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 49842018-04-28t15:57:24.859249z 5 [Note] [MY-010454] [Server] A Temp Orary password is generated for [email protected]: ri5rvf5x5g,e2018-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 where [email PR Otected]: The following "Ri5rvf5x5g,e" is the initial password (excluding the first space). Before changing the password, you need to remember this password, subsequent logins need to use.

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

3.2 Installation Services

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

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 . Stop the service by using the command net stop MySQL . by commandsc delete MySQL/mysqld -remove卸载 MySQL 服务

4. Change your password

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 3.1 installation password, fill in can log in successfully, into the MySQL command mode.

Execute the command in MySQL:

ALTER USER ' root ' @ ' localhost ' identified with Mysql_native_password by ' new password ';

Change the password, pay attention to the end of the command; must have, this is MySQL syntax

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                |+----------- ---------+4 rows 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             | localhost | *27c237a977f4f44d3f551f1a673be14dfd232961 |+------------------+-----------+---------------- ---------------------------+4 rows 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 ' [Email prote cted]# '; #创建用户 (Note: mysql8.0 encryption 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 rows in Set (0.00 sec) MYSQL&GT 

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

Reference from: http://www.cnblogs.com/xiongzaiqiren/p/8970203.html

Mysql-mysql 8.0.11 Installation Tutorial

Related Article

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.