Windows versions of next MySQL5.7 modify encoded as utf-8

MySQL database default character of our new installation is latin1, so every time a new database must modify character, very troublesome. So we have to change it to UTF8 characters.

Amended as follows:

First, modify the MySQL my.ini

5.7 First find my.ini file in the \ ProgramData \ MySQL \ MySQL Server, and then open.

Note: ①, if it is not ProgramData is hidden, Baidu how to display themselves.

         ②, this directory is to install their own choice, not necessarily the same as me.

image


Second, modify the configuration file

Add [client] in

[client]

default-character-set=utf8


image


Was then added at [mysqld]

[mysqld]

character-set-server=utf8


image

Note: In MySQL5.7, no need to add in the [mysql] or [mysqld] default-Character-the SET = utf8 , I am looking for a long time on the Internet, that all previous versions of the old method, as long as the [mysql] or I joined the [mysqld] under such a database service will not start, and led me out here for a long time.


Third, restart mysql

Then restart the MySQL service just fine

win + R enter services.msc

image


The database service restart

image


Then enter the database interface to use show variables like 'char%' to see the situation mysql character set

image

Successfully modified after the database is created in the UTF-8.

Guess you like

Origin www.cnblogs.com/tang-hao-/p/11923849.html