#1273 – Unknown collation: ‘utf8mb4_unicode_520_ci’
You can solve this by finding
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
in your .sql
file, and swapping it with
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
#1273 - Unknown collation: 'utf8mb4_unicode_ci' cPanel
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>";
}
?>
go to phpmyadmin first page get error #1273
My problem solved by uninstalling wamp2.1 and install wamp2.2.
ERROR 1273 (HY000) at line 1520: Unknown collation: 'utf8mb4_0900_ai_ci'
In case someone is still interested in the answer to this question:
This occurs when you try to migrate a database with mysqldump to a server with earlier versions of MySQL than 8.0
Collation utf8mb4_0900_ai_ci is new in MySQL 8.0 and not recognized in earlier versions, so that's why you should replace all instances in your sql file from utf8mb4_0900_ai_ci to utf8mb4_general_ci
Error 1273 but my schema don't contain utf8mb4_0900_ai_ci
Fixed : Just add "&collation=utf8mb4_general_ci'"
engine=create_engine('mysql+mysqlconnector://user:***********@**********:3306/amatdbcharset=utf8mb4&collation=utf8mb4_general_ci')
I have that error#1273 - Unknown collation: 'utf8mb4_0900_ai_ci'
CREATE TABLE payment_methods
( payment_method_id tinyint(4) NOT NULL AUTO_INCREMENT,
name varchar(50) NOT NULL,
PRIMARY KEY (payment_method_id)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
NOTE: COLLATE=utf8mb4_0900_ai_ci replace with COLLATE=utf8mb4_general_ci
REFER: https://www.freakyjolly.com/resolved-when-i-faced-1273-unknown-collation-utf8mb4_0900_ai_ci-error/#.X2jHBGgzZPY
Wordpress site migration - Collation error
See this
It seems that collation is only available for mySql 5.6+. I guess you are on 5.6-.
Related Topics
Escaping Column Names in Pdo Statements
PHP Strtotime +1 Month Adding an Extra Month
Phpmysql Error - #1273 - #1273 - Unknown Collation: 'Utf8Mb4_General_Ci'
How to Make 5 Random Numbers with Sum of 100
PHP - Flushing While Loop Data with Ajax
I'm Getting This Error Code: Invalid Argument Supplied for Foreach()
Why I am Getting Error When Getting Booking from Database
Tablegateway with Multiple from Tables
Dynamic Comparison Operators in PHP
Prevent PHP Script from Being Flooded
Walk Array Recursively and Print the Path of the Walk
File_Get_Contents() How to Fix Error "Failed to Open Stream", "No Such File"
PHP Auto-Kill a Script If the Http Request Is Cancelled/Closed
Paypal Sandbox Ipn Always Returns Invalid
PHP Hsv to Rgb Formula Comprehension