1. Download and unzip
2. Create a My.ini file
Basic configuration: (Note that the encoding must be ANSI)
#代码开始
[Client]
# Set the MySQL client default character set
Default-character-set=utf8
[Mysqld]
#设置3306端口
Port = 3306
# set up the MySQL installation directory
Basedir=d:\mysql-5.7.22-winx64
# Set up a storage directory for MySQL database data
Datadir=d:\mysql-5.7.22-winx64\data
# Maximum number of connections allowed
max_connections=200
# The character set used by the service side defaults to the 8-bit encoded latin1 character set
Character-set-server=utf8
# The default storage engine that will be used when creating a new table
Default-storage-engine=innodb
3. Configure Environment variables:
Create a new system variable mysql_home, and configure the variable value to C:\mysql-5.7.20-winx64;
Edit the system variable path and append the%mysql_home%\bin to the path variable value. Note not overwrite.
4.
Run cmd as an administrator,
Enter the directory C:\mysql-5.7.20-winx64\bin, enter the Mysqld–defaults-file=my.ini–initialize-insecure, return. The data directory is created automatically. (If the Data folder cannot generate an executable mysqld–initialize-insecure test can generate the data directory)
Enter Mysqld–install, carriage return. You will be prompted to install successfully.
Note: This step does not prompt the installation to succeed, but instead prompts the service already exists! This means that the previous installation of MySQL, but the service has not been uninstalled, as long as the input sc delete MySQL, enter, complete the uninstall service.
5. Start the service
Startup: net start MySQL
Stop: net stop MySQL
Note: If you are prompted to start the service: "A system error 2 occurred," it is possible that the installation directory is incorrect, then go to the Bin directory, remove the service through the Mysqld-remove command, and then re-enter the command Mysqld-install, enter.
At this point, MySQL installation is complete.
Change Password:
Mysql5.7 forgot root Password and mysql5.7 change the root password method
Change Password:
mysql> Update Mysql.user Set Authentication_string=password (' 123qwe ') where user= ' root ' and Host = ' localhost ';
* Note that there is no password field in the user table in the new MySQL database.
Instead, the encrypted user password is stored in the Authentication_string field
mysql> flush Privileges;
Mysql> quit;
Excerpt-decompression version of MySQL configuration (version 5.7)