昨天(应该是今天凌晨三点)恢复数据库的时候,发生一个小插曲:
[root@site themes]# /usr/local/mysql/bin/mysql -uweb -p'admin' web
Warning: Using a password on the command line interface can be insecure.
ERROR 1366 (HY000) at line 907: Incorrect string value: 'xF0x9Fx9BxB3, ...' for column 'option_value' at row 1
查看下一下mysql的建表语句:
MySQL
mysql> show create table web.wp_usersG
*************************** 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"搞的鬼,遇到两次字符集恢复数据库的问题了
修复方法:
[client]
default-character-set=utf8mb4
[mysqld]
character-set-server=utf8mb4
停电了,utf8mb4这个字符集有很多新特性,不介绍了。请百度!