Home > Database > Mysql Tutorial > body text

Share the method of installing Mysql5.7.17 under Windows and setting the encoding to utf8

黄舟
Release: 2017-03-22 14:15:09
Original
1525 people have browsed it

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');
Copy after login

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
Copy after login

3. Restart MySQL

mysqld restart
Copy after login

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\ |
+--------------------------+----------------------------------------+
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!