显示字符集,并将相应字符集更改为utf8
show variables like "%char%";
+--------------------------+---------------+| character_set_system | utf8 |
例如
SET character_set_client='utf8';
SET character_set_connection='utf8';
SET character_set_results='utf8'
创建表时:
CREATE TABLE video_author (
sid bigint(11) NOT NULL AUTO_INCREMENT,
nick varchar(64) NOT NULL,
url' varchar(128) NOT NULL,
video_type set('dota', 'lol', 'hearthstone'),
PRIMARY KEY (sid),
KEY index_name (nick)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
如果使用python的mysql连接,还需要在连接时设置charset,例如:
self.conn=MySQLdb.connect(host="127.0.0.1",user="root", passwd="000", db="app_db",port=3306,charset='utf8')
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号