Method of installing Mysql5.7. 17 under Window and setting code to utf8

  • 2021-07-26 09:01:40
  • OfStack

Download

Windows (x86, 64-bit), ZIP Archive are selected for official download of mysql

Installation

1. Unzip I unzip here to the root directory of D disk

Step 2 Initialize

After mysql 5.7, there will be no data directory by default, so the initialization command has changed

Open cmd into the bin directory of mysql, and subsequent commands must be run in the bin directory (even if environment variables are configured)

mysqld-initialize-insecure When 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 1-segment string output in console (remember the string)

You can use the first command here for both of these commands

3. mysqld--install installation prompt is successful before proceeding to the next step

4. Start the service: net start mysql

5. Login: mysql-u root-p No password

Change password


SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');

Change code

1. Copy my. default. ini and rename it my. ini

2. my. ini Add the following code at the corresponding position


[client] 
default-character-set=utf8 
[mysqld]
character-set-server=utf8

3. Restart MySQL


mysqld restart

4. Query code


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 orders

1. Delete the mysql service sc delete mysql

2. Turn on the mysql service net start mysql

3. Stop mysql service net stop mysql


Related articles: