1 mysql> set character_set_client=utf8;2 mysql> set character_set_connection=utf8;3 mysql> set character_set_database=utf8;4 mysql> set character_set_results=utf8;5 mysql> set character_set_server=utf8;6 mysql> set character_set_system=utf8;7 mysql> set collation_connection=utf8;8 mysql> set collation_database=utf8;9 mysql> set collation_server=utf8; 类似这样的即可。这里只是改变了当前链接的配置。 如果是程序链接数据库发生了乱码,建议修改数据库的配置文件。如果输入命令,应该是: 1 ---1.修改数据库字符集2 alter database mini default character set = gb2312; 3 ----2.创建数据库设置字符集4 create database mydb character set gb2312;
时间: 2024-10-13 22:26:10