Method Steps of Setting utf 8 Encoding in mysql Database
- 2021-12-09 10:23:48
- OfStack
Modify the/etc/my. cnf or/etc/mysql/my. cnf file
[client]
default-character-set = utf8
[mysqld]
default-storage-engine = INNODB
character-set-server = utf8
collation-server = utf8_general_ci
Restart mysql and use the mysql client to check the encoding
show variables like '%char%';
Use UTF-8 encoding when creating a new database
create database 'test' default character set utf8 collate utf8_general_ci;
Create tables and create fields using UTF-8 encoding
create table test (
'id' int(10) unsigned not null auto_increment,
'name' varchar(50) character set utf8 default '',
primary key('id')
) default charset=utf8;