Phpmysql Error - #1273 - #1273 - Unknown Collation: 'Utf8Mb4_General_Ci'

#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



Leave a reply



Submit