如何在 1and1 vps 中从 MySQL 5.1.72 升级到 5.5.45

How To Upgrade from MySQL 5.1.72 to 5.5.45 in 1and1 vps

我从 1and1.com 购买了 VPS 并更改了我域的名称服务器(以前它在 godaddy 上)。但我注意到在 godaddy 中我使用的是 MySQL 5.5.45 而这里的 1and1 mysql 版本是 5.1.72

因此,当我 运行 我的数据库脚本在 1and1 上使用 5.1.72 MySQL 版本时,它给出了错误

未知排序规则:'utf8mb4_unicode_ci'

我的数据库是 wordpress 数据库 - 我在下面的代码中遇到错误,因为此代码包含 'utf8mb4_unicode_ci'

CREATE TABLE IF NOT EXISTS `wp_commentmeta` (
  `meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `comment_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `meta_key` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `meta_value` longtext COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`meta_id`),
  KEY `comment_id` (`comment_id`),
  KEY `meta_key` (`meta_key`(191))
) ENGINE=MyISAM  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=174 ;

我以前遇到过这个问题。 我已将脚本文件中的 "utf8mb4" 更改为 "utf8"。 并且 "utf8mb4_unicode_ci" 到 "utf8_general_ci"。 至此,脚本执行成功。 希望对你有所帮助。