Mysql insert Chinese into full question mark?? The solution to the problem
- 2020-06-01 11:09:39
- OfStack
1. Check and modify the my.ini configuration file of mysql
default-character-set=utf8
2, the establishment of a database is to specify a character set
create database mydb default character set utf8 collate utf8_general_ci;
3. Set up data representation to specify character set:
Command in question:
CREATE TABLE IF NOT EXISTS `mydb` (
`username` varchar(64) NOT NULL,
`userid` int(11) NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Correct command:
CREATE TABLE IF NOT EXISTS `mydb` (
`username` varchar(64) NOT NULL,
`userid` int(11) NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Note: mysql version: 5.5.24