昨天(应该是今天凌晨三点)恢复数据库的时候,发生一个小插曲:
0 1 2 |
[root@site themes]# /usr/local/mysql/bin/mysql -uweb -p'admin' web </tmp/web_wp_20160422_687.sql Warning: Using a password on the command line interface can be insecure. ERROR 1366 (HY000) at line 907: Incorrect string value: '\xF0\x9F\x9B\xB3, ...' for column 'option_value' at row 1 |
查看下一下mysql的建表语句:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
mysql> show create table web.wp_users\G *************************** 1. row *************************** Table: wp_users Create Table: CREATE TABLE `wp_users` ( `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `user_login` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `user_pass` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `user_nicename` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `user_email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `user_url` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `user_registered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `user_activation_key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `user_status` int(11) NOT NULL DEFAULT '0', `display_name` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`ID`), KEY `user_login_key` (`user_login`), KEY `user_nicename` (`user_nicename`), KEY `user_email` (`user_email`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |
大概原因是字符集"utf8mb4"搞的鬼,遇到两次字符集恢复数据库的问题了
第一次:https://note.t4x.org/database/restoring-database-error/
修复方法:
0 1 2 3 |
[client] default-character-set=utf8mb4 [mysqld] character-set-server=utf8mb4 |
停电了,utf8mb4这个字符集有很多新特性,不介绍了。请百度!SourceByrd's Weblog-https://note.t4x.org/database/incorrect-string-value-error/ SourceByrd's Weblog-https://note.t4x.org/database/incorrect-string-value-error/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!