win10 installation mysql5.7 complete tutorial

This link: https: //blog.csdn.net/wudinaniya/article/details/81115916
a download mysql5.7.22
mysql5.7.22 Download: https: //dev.mysql.com/downloads/mysql/5.7.html#downloads

 

 

 

Two mounting mysql
. 1, mysql extracting archive, into position (into the C drive, it may involve problems when modifying permissions ini file):

 

FIG as: In this case, after extracting the file data directory and no ini file.

2, extract the directory E: New my.ini file \ mysql 5.7.22--winx64 under, copy the following

[mysqld]
port = 3306
basedir=E:\mysql-5.7.22-winx64
datadir=E:\mysql-5.7.22-winx64\data
max_connections=200
character-set-server=utf8
default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysql]
default-character-set=utf8
3、下面配置环境变量

This Computer> Properties> Advanced System Settings> Environment Variables

Create a new variable name in the System variables section: MYSQL_HOME, variable values: E: \ mysql-5.7.22-winx64

 

 

Find Path, Edit> New, add the environment variable% MYSQL_HOME% \ bin

 

4, MySQL installation process:

Run as administrator cmd, dos window open, go to the directory E: \ mysql-5.7.22-winx64 \ bin

 

Run the command: mysqld --initialize (this time will generate data directory)

E: \ MySQL-5.7.22-Winx64 \ bin> mysqld --initialize
E: \ MySQL-5.7.22-Winx64 \ bin>
Run command: mysqld -install (installation)

 

Run the command: net start mysql (start mysql service)

E: \ MySQL-5.7.22-Winx64 \ bin> NET Start MySQL
MySQL service is starting.
MySQL service has started successfully.
Mysql service can be seen in the Task Manager

 

5, using the temporary password, log on MySQL, change the root password

5.1, find suffix of .err file in the previously generated data directory, the file has a temporary password

A temporary password is generated for root@localhost: C.fE;Sf&L4Gu

C.fE; Sf & L4Gu is the temporary password.

5.2, using the temporary password, run mysql -uroot -p landing.

E: \ MySQL-5.7.22-Winx64 \ bin> -p MySQL-uroot-
the Enter password: ************
. MySQL is available for purchase at The Monitor Commands to End with; or \ G.
Your MySQL Connection 2 iS the above mentioned id
Server Version: 5.7.22

Copyright (c) 2000, 2018, the Oracle and / or the ITS Affiliates All Rights Reserved..
5.3, execute the following command to change the MySql root password. Which sdbrk new password.

MySQL> SET password for the root @ localhost = password ( 'sdbrk');
Query the OK, 0 rows affected,. 1 warning (0.00 sec)

MySQL> quit;
Bye
5.3, the quit or exit command myql, the new password sdbrk re log in. Be able to log in successfully.

C:\Users\qxmak>mysql -uroot -p
Enter password: *****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.22 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
执行sql命令也没问题:

mysql> show grants;
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
2 rows in set (0.01 sec)

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

MySQL> MySQL use;
Database changed
MySQL> the SELECT the User, the User from Host;
+ --------------- + ----------- +
| the User | Host |
----------- + + --------------- +
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+ - + ----------- + --------------
3 rows in the SET (0.00 sec)
last query statement can be seen from the above query, root users can not remotely log in .

 

5.4, ​​remote login privileges granted to the root user:

MySQL> Grant All privileges ON * * to root @ '%' IDENTIFIED by 'sdbrk';.
Query the OK, 0 rows affected, 1 warning (0.00 sec)
5.5, refresh permission settings to take effect, OK.

MySQL> the flush privileges;
Query the OK, 0 rows affected (0.00 sec)
5.6, remote connection test on a remote machine: mysql -h192.168.0.150 -uroot -p

5.6.1, an error while testing a remote connection: Can not connect on a remote server ip

C:\Users\Administrator>mysql -h192.168.0.150 -uroot -p
Enter password: *****
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.0.150' (10060)

5.6.2, the reason is not a remote connection, the firewall I drove it. There are two options to solve this problem:

Option One: turn off the firewall.

Option Two: Do ​​not turn off the firewall, but inbound rules, open port 3306 mysql.

Here are Option Two:

Enter the start menu search box, <1> "defender", open the "Windows Defender Firewall"> Advanced Settings

 

<2> Inbound Rules> New rules open "new Inbound Rule Wizard"

 

 

<3> Rule Type: Select the "port", the next step

Protocol and port: check applies to "TCP" and "specific local port" and specify port number 3306, the next step

 

Operation: Check "allow connection", the next step

Profile: when to apply the rule? Check All

 

Name: free to write your own, click on the "Finish" button.

 

<4> In this case, mysql3306 appear in the inbound rules. Enabled state.

 

 

Re-use remote machine landing mysql, you can normally logged:

C:\Users\Administrator>mysql -h192.168.0.150 -uroot -p
Enter password: *****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.22 MySQL Community Server (GPL)

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.
 

 

Supplement:
reload problem:
When some people first installed mysql, the file on the C drive, prompts the question of powers more annoying problems encountered in the process of trying to reload, suggesting that mysql has been installed, look online to a post can solve the problem:

https://jingyan.baidu.com/article/5d368d1eaf46ea3f61c0576f.html

The basic steps include turning off the MySQL service, delete the registry before deleting the my.ini file, run a few commands to delete, and then restart my computer last best you can reinstall
----------- -----
Disclaimer: this article is the original article CSDN bloggers "wudinaniya", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/wudinaniya/article/details/81115916

Guess you like

Origin www.cnblogs.com/zpaixx/p/11569262.html