The MySQL database is an open-source database that is widely used. The following is a procedure for modifying the character encoding of a MySQL database and converting the character encoding of a table into a Utf-8 method, which a friend can refer to.
MySQL converts the character encoding of a table into Utf-8:
1 |
alter table tb_anniversary convert to character set utf8; |
Modify the database MySQL character encoding to UTF8:
Windows MySQL default character set modification
first, modify through the MySQL command line:
Set Character_set_client=utf8;
Set Character_set_connection=utf8;
Set Character_set_database=utf8;
Set Character_set_results=utf8;
Set Character_set_server=utf8;
Support for character sets is refined to four levels:
Servers (server), database, data tables (table), and connections (connection).
The settings for viewing the character set and ordering of the system can be set through the following two commands:
SHOW VARIABLES like ' character% ';
SHOW VARIABLES like ' collation_% ';
Second, modify the encoding method by MySQL file
1. Locate the My.ini file in the MySQL installation directory (if not, copy the My-medium.ini, then rename it to My.ini)
2. Find the [client] and [mysqld] fields in the My.ini file, add Default-character-set=utf8 below, save and close
- [MySQL]
- Default-character-set=utf8
- [Mysqld]
- Character-set-server=utf8
3. Restart MySQL Service
"The default encoding Default-character-set=utf8 can also be changed to DEFAULT-CHARACTER-SET=GBK"
, query the details of each field in the current table: Show full columns from table_name;
MySQL modifies the database encoding (database character set) and the method of the character encoding of the table