Home > Database > Mysql Tutorial > body text

How to install mysql version 5.7.21

清浅
Release: 2020-09-09 11:17:15
Original
8058 people have browsed it

Installation method of MySQL version 5.7.21: First download the mysql installation package and decompress it; then install and configure the environment variables, and after configuring, create a new file to hold the "my.ini" file; finally use the cmd command Just install, initialize and start the database.

How to install mysql version 5.7.21

Installation method of MySQL5.7.21 version: Download the mysql installation package and unzip it, then install and configure the environment variables. After configuration, create a new file to store my. ini file, and then install, initialize and start the database under the cmd command

[Recommended course: MySQL Tutorial]

The installation method of MySQL5.7.21 version is as follows

(1) To download the decompressed version of MySQL, download address: https://www.mysql.com/downloads/

How to install mysql version 5.7.21

How to install mysql version 5.7.21

(2) Unzip the installation package and customize the installation path. In this example, C:\software\ , so the full path of MySQL is: C:\software\mysql-5.7.21-winx64

How to install mysql version 5.7.21

(3) Configure environment variables and add system environment variables:

Key name: MYSQL_HOME

The value is: C:\software\mysql-5.7.21-winx64

How to install mysql version 5.7.21

##Add in Path: %MYSQL_HOME %\bin, please note that the ";" symbol between different values ​​in Path cannot be omitted

(5) Prepare the my.ini file. You can create a new my.txt file first, and then modify the file suffix by renaming it. It is .ini. The my-default.ini file may exist after decompression in previous versions, but it does not exist in the 5.7.21 version, so you need to manually create the file yourself. The content of the file is as follows:

[mysqld]
port = 3306
basedir=C:/software/mysql-5.7.21-winx64
datadir=C:/software/mysql-5.7.21-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
Copy after login

Pay attention to this step : The red box is the installation path of MySQL, and use "/" instead of "\" between folders, otherwise errors may occur in the following operations

How to install mysql version 5.7.21

Edit After completing the my.ini file, place the my.ini file in the C:\software\mysql-5.7.21-winx64 directory

(5) Open the cmd command window as an administrator and switch the directory to In the bin directory of the MySQL installation directory


How to install mysql version 5.7.21

(6) Execute the following statement to install MySQL

mysqld -install
Copy after login

After executing the command, the prompt: Service successfully installed. Indicates successful installation

(7) Execute the following statement to initialize MySQL

mysqld --initialize-insecure --user=mysql
Copy after login

After executing the command, the data directory will be generated in the MySQL installation directory and the root user will be created.

How to install mysql version 5.7.21

(8) Execute the following command to start the mysql service

net start mysql
Copy after login

After execution, the following prompt will appear:

The MySQL service is starting. .

The MySQL service has been started successfully.

(9) After starting MySQL, the password of the root user is empty. Set the password. The command is as follows:

mysqladmin -u root -p password New password

Enter password: Old password

When you need to enter the old password, since the old password is empty, just press Enter.

MySQL5.7.21 is installed.

Summary: The above is the entire content of this article, I hope it will be helpful to everyone

The above is the detailed content of How to install mysql version 5.7.21. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template