Heim > Fragen und Antworten > Hauptteil
mysql> Variablen wie „%colla%“ anzeigen;
+-------------------------------------+---------------- -+
| Variablenname | Wert |
+------------------------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+-------------------------------------+-----------------+
mysql> Variablen wie „%char%“ anzeigen;
+--------------------------+------------ -----------------------------------+
| Variablenname | Wert |
+--------------------------+------------------- -------------+
| Character_set_client | utf8 |
| Zeichensatz_Verbindung | utf8 |
| Character_set_database | utf8 |
| zeichensatz_dateisystem | binär |
| Character_set_results | utf8 |
| Character_set_server | utf8 |
| Character_set_system | utf8 |
| Character_sets_dir | C:phpStudyPHPTutorialMySQLsharecharsets |
+----------------------------------------+----------------- ---------------+
mysql> Tabelle erstellen emp3(
-> `id` int(11) NOT NULL AUTO_INCREMENT,
-> `username` varchar(50) NOT NULL,
-> `balance` float NOT NULL,
-> `province ` varchar(20) NOT NULL,
-> `age` tinyint(3) unsigned NOT NULL,
-> `sex` tinyint(4) NOT NULL,
-> PRIMARY KEY (`id`)
- > ) ENGINE=InnoDB CHARSET=utf8;
Abfrage OK, 0 Zeilen betroffen (0,03 Sek.)
天忆2018-08-28 16:05:48
因为cmd命令行的字符编码是gbk,所以你插入的是gbk编码的数据,而你的表是utf8编码,所以插入会乱码,你可以试建一个gbk编码的数据表,执行set names gbk;然后再命令行里插入数据