MySQL is an open source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter, and "SQL", the abbreviation for Structured Query Language.
—— Wikipedia
Preparation
Object | Value |
---|---|
MySql Version | mysql-5.7.23 |
Operation System | Windows 10 x64 |
Install
Download
Object | Value |
---|---|
Offical Product | Removed |
Unoffical Link | mysql-5.7.23-winx64.zip |
Access Code | NULL |
Download and unzip at suitable location, such as D:\mysql-5.7.23-winx64
[*] Caution! Using D:\mysql-5.7.23-winx64
as a location is a precondition for next all the examples. Change one and must change all.
Add Path
Computer
-> Attributes
-> Advanced System Settings
-> Environmental Variable
-> System Variable
-> Path
-> Edit
-> New
: D:\mysql-5.7.23-winx64\bin -> OK
Configure
Edit Configuration File
New my.ini
at D:\mysql-5.7.23-winx64\
1 | D:\mysql-5.7.23-winx64\my.ini |
Initialize Database
1 | cd D:\mysql-5.7.23-winx64\bin # Under administrator privileges |
Change Initial Password
First cmd1
2 net stop mysql
mysqld --skip-grant-tables # Keep this cmd running and open second cmd
Second cmd1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 mysql -u root -p # Enter MySql Server without code
Enter password: # Press `ENTER`
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23
... ...
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
update mysql.user set authentication_string=password("PASSWORD") where user="root"; # Type your password instead of `PASSWORD`
Query OK, 1 row affected, 1 warning (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 1
flush privileges; # Refresh
Query OK, 0 rows affected (0.01 sec)
quit; # Exit Database
Bye
taskkill /im cmd.exe -F # Close `First cmd` and `Second cmd`
Log In
Log in database with code changed1
2
3
4
5 mysql -u root -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
... ...
Change Password Again
1 | SET PASSWORD = PASSWORD('NEWPASSWORD'); # Type your new password instead of `NEWPASSWORD` |