#1273 - Unknown collation: #39;utf8mb4_unicode_ci#39; cPanel(#1273 - 未知排序规则:utf8mb4_unicode_ci cPanel)
问题描述
我的本地机器上有一个 WordPress 数据库,我想将其传输到 cPanel 上的托管 phpMyAdmin.但是,当我尝试将数据库导入环境时,我不断收到此错误:
I have a WordPress database on my local machine that I want to transfer to a hosted phpMyAdmin on cPanel. However, when I try to import the database into the environment, I keep getting this error:
#1273 - Unknown collation: 'utf8mb4_unicode_ci'
我试过谷歌搜索,我能找到的唯一解决方案是这个 phpmysql error - #1273 - #1273 - Unknown collation: 'utf8mb4_general_ci' 到目前为止没有太大帮助.我已尝试清除 cookie,但仍然无法正常工作.请帮忙!
I have tried to Google around and the only solution I can find is this one phpmysql error - #1273 - #1273 - Unknown collation: 'utf8mb4_general_ci' which as by now isn't much help. I have tried clearing the cookies but it still won't work. Please help!
推荐答案
我遇到了同样的问题,因为我们所有的服务器都运行旧版本的 MySQL.这可以通过运行 PHP 脚本来解决.将此代码保存到文件中并输入数据库名称、用户和密码运行它,它会将排序规则从 utf8mb4/utf8mb4_unicode_ci
更改为 utf8/utf8_general_ci
I had the same issue as all of our servers run older versions of MySQL. This can be solved by running a PHP script. Save this code to a file and run it entering the database name, user and password and it'll change the collation from utf8mb4/utf8mb4_unicode_ci
to utf8/utf8_general_ci
<!DOCTYPE html>
<html>
<head>
<title>DB-Convert</title>
<style>
body { font-family:"Courier New", Courier, monospace; }
</style>
</head>
<body>
<h1>Convert your Database to utf8_general_ci!</h1>
<form action="db-convert.php" method="post">
dbname: <input type="text" name="dbname"><br>
dbuser: <input type="text" name="dbuser"><br>
dbpass: <input type="text" name="dbpassword"><br>
<input type="submit">
</form>
</body>
</html>
<?php
if ($_POST) {
$dbname = $_POST['dbname'];
$dbuser = $_POST['dbuser'];
$dbpassword = $_POST['dbpassword'];
$con = mysql_connect('localhost',$dbuser,$dbpassword);
if(!$con) { echo "Cannot connect to the database ";die();}
mysql_select_db($dbname);
$result=mysql_query('show tables');
while($tables = mysql_fetch_array($result)) {
foreach ($tables as $key => $value) {
mysql_query("ALTER TABLE $value CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci");
}}
echo "<script>alert('The collation of your database has been successfully changed!');</script>";
}
?>
这篇关于#1273 - 未知排序规则:'utf8mb4_unicode_ci' cPanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:#1273 - 未知排序规则:'utf8mb4_unicode_ci' cPanel
基础教程推荐
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01