The first step, download the database version you need from the official website, here I use the latest version of the 5.7.15;
- Unzip the file you downloaded, I'll name it MySQL Server 5.7, I put it under D:\Program files\
- You will find that the new MySQL root directory does not have the Data folder (processed later)
- Add a path to the system variable path D:\Program files\mysql Server 5.7, your installation directory, that is, the location of the folder you unzipped. [Mysqld]
- To create a new file My.ini in the MySQL installation directory (such as D:\mywork\mysql-5.7.16-winx64), add the following configuration:
[Mysqld]
Basedir=d:\mywork\mysql-5.7.16-winx64
Datadir=d:\mywork\mysql-5.7.16-winx64\data
Port = 3306
Next is the important command.
- Mysqld--initialize--user=mysql--console
At this point, the Data folder and its contents are created automatically, and the final part generates a random password
Mysqld--install MySQL (Install database)
net start MySQL (startup database)
Mysql-u root-p (login)
Enter the random password generated above
连接权限数据库: use mysql; (别忘了最后加分号)
(改密码)mysql>update mysql.user set authentication_string=password(‘新密码‘) where user=‘root‘ and Host =‘localhost‘;
mysql>flush privileges; #更新权限
- Quit
Zip archive installation of MySQL database