Mysql modifies the environment's default character set to UTF-8 (of course you can set it to UTF-8). First, you must turn off the mysql service in the service and then go to your mysql installation path, if mysql modifies the environment's default character set to UTF-8 (you can also set it to UTF-8)
First, you must turn off the mysql service in the service.
Then go to the installation path of your mysql instance. if it is a custom file, find the custom path. the default value is C: \ Program Files \ MySQL Server 5.0 \ my. ini.
Find the client mysql to addDefault-character-set = utf8
Add the following to mysqld: default-character-set = utf8
Init_connect = 'set NAMES utf8'
The following statement is used to check whether the encoding method has been modified:
Show variables like 'char % ';
If yes, your previous database is not configured properly:
For an existing database, you can change the encoding method as follows:
A. modify the mysql database encoding. if the mysql database encoding is incorrect, run the following command in MYSQL: alter database test default character set utf8;
The preceding command sets the encoding of MYSQL's test database to utf8.
B. modify the MYSQL TABLE encoding: ALTER TABLE category DEFAULT CHARACTER SET utf8;
The preceding command changes the category encoding of a table to utf8.
C. modify the field encoding:
Alter table 'test' CHANGE 'DD' DD' VARCHAR (45) character set utf8 COLLATE utf8_bin NOT NULL
The preceding command changes the dd field encoding in the MYSQL database test table to utf8.
The following code inserts a Chinese character in a command line:
Set names gb2312; sometimes this sentence is critical!
Insert into charset values ('lmj ');
Then restart the service.
If the service cannot be started, run cmd as an administrator to go to the mysql installation directory and run
Mysqld-remove service
Then
Mysqld-install installation service
You can.