MySQL 5.7 download, installation and configuration detailed tutorial

What I installed here is MySQL 5.7.43. The following is a detailed download, installation and configuration tutorial.

1. Download steps

  1. Enter the official website: https://www.mysql.com/
  2. Scroll to the bottom of the homepage and find MySQL Community server
  3. Select the version you want and the corresponding computer configuration to download.Insert image description here
    Insert image description here
  4. After downloading, unzip it to the directory you want to save.Insert image description here

2. Configure environment variables

1. Right-click this computer->Properties->Advanced system settings->Environment variables->System variables
Insert image description here
2. Create a new system variable

Variable name: MYSQL_HOME
Variable value: D:\MySQL\mysql-5.7.43-winx64

Insert image description here
3. Add the newly created system variable to Path

%MYSQL_HOME%\bin

Insert image description here
4. Configure the my.ini file.
Create a new my.ini file.
Insert image description here
The contents of the my.ini file:

[mysqld]
#端口号
port = 3306
#mysql-5.7.43-winx64的路径
basedir=D:\MySQL\mysql-5.7.43-winx64
#mysql-5.7.43-winx64的路径+\data
datadir=D:\MySQL\mysql-5.7.43-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 

5. Install MySQL
① Enter cmd in the search box and run as administrator Insert image description here
② Enter the MySQL installation directory D:\MySQL\mysql-5.7.43-winx64 in cmd
Insert image description here
and enter the installation command: mysqld -install . If Service successfully installed appears, it is proved The installation is successful; if Install of the Service Denied appears, it means that cmd is not running with administrator privileges:
Insert image description here
continue to enter the command: mysqld --initialize to initialize the database
and then enter the startup command: net start mysql . The following prompt appears to prove that MySQL is started successfully:
Insert image description here
6.Set MySQL password

  1. Setting the password is mainly used to solve the problem of ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
  2. To stop the MySQL service, enter the command line net stop mysql :Insert image description here
  3. Find the my.ini file you just created and add skip-grant-tablesInsert image description here
  4. Restart MySQL through the command net start mysqlInsert image description here
  5. Then enter the command mysql -u root -p . There is no need to enter a password. Just press Enter to enter MySQL.Insert image description here
  6. Enter the command line use mysql , enter the database,
    and then enter the command line to change your MySQL password:
    update user set authentication_string=password("ping1212") where user="root";
    Insert image description here
    7. Stop the MySQL service and enter service in the system search box. Find MySQL. Just right-click and click Stop. 8. Then delete skip-grant-tables
    Insert image description here
    Insert image description here
    in the my.ini file just now , start cmd again (as administrator), enter the startup command: net start mysql , then enter mysql -u root -p , and then enter the value you just set Password, the following information appears to prove that the setting is successful! 9. Enter the command use mysql , and it will prompt that you need to reset the password. 10. Enter the command: alter user user() identified by “ping1212”; My password is: ping1212 Enter the command line use mysql again . The following prompt means the installation is successful!
    Insert image description here
    Insert image description here
    Insert image description here



    Insert image description here

Guess you like

Origin blog.csdn.net/weixin_43952429/article/details/132183729