This article mainly introduces the method of installing Mysql5.7.17 under Windows and setting the encoding to utf8. It is very good and has reference value. Friends who need it can refer to it.
Download
mysql official download select Windows (x86, 64-bit), ZIP Archive
Installation
1. Unzip it here to the root directory of drive D
2. Initialize
Mysql5.7 will not be there by default data directory, so the initialization command has changed
Open cmd and enter the bin directory of mysql. Subsequent commands must be run in the bin directory (even if environment variables are configured)
mysqld-- initialize-insecure After this method is initialized, the root user has no password
mysqld--initialize --console. After this method is initialized, the root user has a password. The password is a string output in the console (remember this string)
Both of these two commands can be used here. The first one
3.mysqld --install requires a successful installation prompt. Go to the next step
4. Start the service: net start mysql
5. Log in: mysql -u root -p No password
Change password
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
Change encoding
1. Copy my.default.ini and rename it to my.ini
2.my.ini Add the following code to the corresponding location
[client] default-character-set=utf8 [mysqld] character-set-server=utf8
3. Restart MySQL
mysqld restart
4. Query encoding
show variables like ‘character%'; +--------------------------+----------------------------------------+ | Variable_name | Value | +--------------------------+----------------------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | D:\mysql-5.7.17-winx64\share\charsets\ | +--------------------------+----------------------------------------+
Other commands
1. Delete the mysql service sc delete mysql
2. Start the mysql service net start mysql
3. Stop the mysql service net stop mysql
The above is the detailed content of Share the method of installing Mysql5.7.17 under Windows and setting the encoding to utf8. For more information, please follow other related articles on the PHP Chinese website!