Mysql - Super detailed environment construction (Windows)

foreword

If you want to build in the Linuxenvironment , please refer to the detailed steps of linux - installation and configuration of Mysql .

This article will complete the construction step by step from 0 to 1, from the perspective of Xiaobai.

download

Baidu network disk: https://pan.baidu.com/s/1dfnhei5PbbHbWNMgCuLObQ
Extraction code: 79oj

After you download it, you will get the compressed package as shown in the figure below:
insert image description here
Then unzip it, store it in any directory (no Chinese), and wait for it to be used.

first step

First you need to initialize the database.

Open Mysqlthe , navigate to the bindirectory, as shown in the following figure:
insert image description here
In this directory, open the cmdwindow and execute the following command:

mysqld --initialize --console

After success, pay attention to copy and record the characters in the red box, it is the first randomly generated password:
insert image description here

second step

After initializing the database, it will now be Mysqlinstalled as Windowsa service of .

Still in the bindirectory , then cmdexecute the following command in the window:

mysqld -install

After success, you will get a feedback prompt as shown in the following figure:
insert image description here

third step

At this point, you have the ability to start the Mysqlservice .

Still in the bindirectory , then cmdexecute the following command in the window:

net start mysql

After success, you will get a feedback prompt as shown in the following figure:
insert image description here

the fourth step

Everything is ready, at this point we log in to the database.

Still in the bindirectory , then cmdexecute the following command in the window:

mysql -u root -p

The window will ask you to enter your password, using the temporary password you copied earlier,

It is successful if the following picture appears:
insert image description here

the fifth step

If you want to change the password (do not want to use the default generated password), set it as follows.

Execute the following command in the cmdwindow :

alter user 'root'@'localhost' identified by '您的密码';

For example, set the password to root, as shown in the following figure:
insert image description here
You log out of the database, try the newly set password (root), and execute the following command:

quit;

After exiting, continue to execute the mysql -u root -pcommand and log in with the new password: the login is successful when
insert image description here
appears .mysql>

Step 6

Since each startup needs to be performed in the bindirectory , we configure the environment variables, and then the service can be started anywhere.

Open the Environment 1-3Variables .
insert image description here
Then go 1-3ahead .
insert image description here
Finally save.

Guess you like

Origin blog.csdn.net/weixin_44198965/article/details/123821811