foreword
If you want to build in the
Linux
environment , 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:
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 Mysql
the , navigate to the bin
directory, as shown in the following figure:
In this directory, open the cmd
window 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:
second step
After initializing the database, it will now be
Mysql
installed asWindows
a service of .
Still in the bin
directory , then cmd
execute the following command in the window:
mysqld -install
After success, you will get a feedback prompt as shown in the following figure:
third step
At this point, you have the ability to start the
Mysql
service .
Still in the bin
directory , then cmd
execute the following command in the window:
net start mysql
After success, you will get a feedback prompt as shown in the following figure:
the fourth step
Everything is ready, at this point we log in to the database.
Still in the bin
directory , then cmd
execute 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:
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 cmd
window :
alter user 'root'@'localhost' identified by '您的密码';
For example, set the password to root
, as shown in the following figure:
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 -p
command and log in with the new password: the login is successful when
appears .mysql>
Step 6
Since each startup needs to be performed in the
bin
directory , we configure the environment variables, and then the service can be started anywhere.
Open the Environment 1-3
Variables .
Then go 1-3
ahead .
Finally save.