- Download Mysql-xxx.zip (free install version)
- Unzip to your desired directory (mine is D:\mysql\), open the Mysql-5.7.21-winx64 folder, create a new My.ini file, enter:
[MySQL]
# Set the MySQL client default character set
Default-character-set=utf8
[mysqld]
#设置3306端口
Port = 3306
# settings MySQL installation directory
Basedir=d:\mysql\mysql-5.7.21-winx64
Span class= "Hljs-preprocessor" > # Set the data storage directory for the MySQL database
Datadir=d:\mysql\mysql-5.7.21-winx64\data
# Allow maximum number of connections
Max_connections=200
Character-set-server=utf8
Default-storage-engine=innodb
< Span class= "Hljs-number" >< Span class= "Hljs-preprocessor" > < Span class= "Hljs-preprocessor" > 3. Open Windows environment variable settings, in the path variable of the environment variable, put the full path of the MySQL bin directory inside, such as: D:/mysql/mysql-5.7.21-winx64/bin;
4. Open the Command window in admin mode and go to d:/ Mysql/mysql-5.7.21-winx64 directory, use the Midir Data command to create the data folder;
< Span class= "Hljs-number" >< Span class= "Hljs-preprocessor" > < Span class= "Hljs-preprocessor" > Then, go to d:/mysql/mysql-5.7.21-winx64/ Bin < Span class= "Hljs-number" >< Span class= "Hljs-preprocessor" > < Span class= "Hljs-preprocessor" >
Command: mysqld--initialize//Initialize Data directory
< Span class= "Hljs-number" >< Span class= "Hljs-preprocessor" > < Span class= "Hljs-preprocessor" > command: mysqld--install < Span class= "Hljs-number" >< Span class= "Hljs-preprocessor" > < Span class= "Hljs-preprocessor" >//install MySQL to uninstall with: SC delete mysql,mysqld-remove
command: Net Start MySQL//startup MySQL
(may be experiencing problems, The MySQL service is starting. The mSQL service could not be started. The service did not report any errors. Please type NET helpmsg 3534 for more help. )
"solution:"
First, delete the data file, and then use the command: Delete service, generate default data directory under Bin directory, install service, restart Service
5. When you have successfully entered the service, use
Mysql-u Root-p Enter
Enter the password (in the file with the suffix. Err in the Data folder)
Enter back and return.
(You may encounter an error with Access denied for user ' root ' @ ' localhost ')
The reason is that the root account does not open the remote access permission by default, so you need to modify the relevant permissions.
"Solution:"
Open the MySQL directory (my is in d:/mysql/mysql-5.7.21-winx64) under the My.ini file, edit, add a line at the end of the file "Skip-grant-tables", save and close the file.
To restart the MySQL service:
6. Change the password
There are three ways to do this:
① with Set password command: Log in to MySQL first.
Format:mysql> set password for user name @localhost = password (' new password ');
Example:mysql> set password for [email protected] = password (' 123 ');
(Can be directly mysql> set password = password (' 123 ');)
② with mysqladmin (used without logging in to MySQL)
Format: Mysqladmin-u username-P Old password password new password
Example: mysqladmin-uroot-p123456 password 123
③ editing the user table directly with update
First log in to MySQL.
mysql> use MySQL;
mysql> Update user set Password=password (' 123 ') where user= ' root ' and host= ' localhost ';
mysql> flush Privileges;
WIN10 download installation and configuration of the installation-free version of MySQL