25

I have just installed PhpMyAdmin v4.1.5 English only

I have set it up to access 2 servers - the local one on my PC and the remote one on my server

All is fine for my local PC but when I log in to my remote server I get the message

Error

MySQL said:

#1273 - Unknown collation: 'utf8mb4_general_ci'

Searching the PhpMyAdmin code finds one reference to this in DatabaseInterface.class.php

        if (PMA_MYSQL_INT_VERSION >  50503) {
            $default_charset = 'utf8mb4';
            $default_collation = 'utf8mb4_general_ci';
        } else {
            $default_charset = 'utf8';
            $default_collation = 'utf8_general_ci';
        }

No idea what this is but it seems to be setting the default charset & collation wrongly

5
  • Does the local machine run Windows?
    – Lars Beck
    Jan 17, 2014 at 16:15
  • I am facing the same issue with linux.
    – dknight
    Jan 18, 2014 at 11:28
  • 1
    I am having the same issue, but only in Firefox. Using Chrome works fine. Strange right?
    – Louis W
    Jan 28, 2014 at 16:53
  • yes that code is causing the issue. If I remove the if else condition and have just the code which is inside the else condition it works fine.
    – Virendra
    Mar 18, 2014 at 19:05
  • Here is the link to the issue in tracker: sourceforge.net/p/phpmyadmin/bugs/4236
    – Virendra
    Mar 18, 2014 at 19:14

6 Answers 6

64

This solution worked for me

1) Click the "Export" tab for the database

2) Click the "Custom" radio button

3) Go the section titled "Format-specific options" and change the dropdown for "Database system or older MySQL server to maximize output compatibility with:" from NONE to MYSQL40.

4) Scroll to the bottom and click "GO".

If it's related to wordpress, more info on why it is happening.

4
  • Worked for me too - Thanks :) Jul 17, 2015 at 10:55
  • Great solution. It helped me a lot.
    – arefindev
    Sep 24, 2015 at 16:32
  • Thank you very much for the useful tip.
    – Cody
    Oct 5, 2016 at 20:36
  • Good one, Anyone knows how to do the same in mysql workbench
    – Gowri
    Oct 11, 2017 at 15:49
27

You can fix this issue by deleting browser cookie from the begining of time. I have tried this and it is working fine for me.

To delete only cookies:

  1. hold down ctrl+shift+delete
  2. remove all check boxes except for cookies of course
  3. use the drop down on top to select "from the beginning of time
  4. click clear browsing data
1
10

There are two steps to fix this.

First edit phpMyAdmin/libraries/DatabaseInterface.class.php

Change:

    if (PMA_MYSQL_INT_VERSION >  50503) {
        $default_charset = 'utf8mb4';
        $default_collation = 'utf8mb4_general_ci';
    } else {
        $default_charset = 'utf8';
        $default_collation = 'utf8_general_ci';
    }

To:

    //if (PMA_MYSQL_INT_VERSION >  50503) {
    //    $default_charset = 'utf8mb4';
    //    $default_collation = 'utf8mb4_general_ci';
    //} else {
        $default_charset = 'utf8';
        $default_collation = 'utf8_general_ci';
    //}

Then delete this cookie from your browser "pma_collation_connection".
Or delete all Cookies.

Then restart your phpMyAdmin.

(It would be nice if phpMyAdmin allowed you to set the charset and collation per server in the config.inc.php)

1
  • 3
    Deleting the pma_collation_connection already made the error go away for me! Dec 5, 2014 at 9:55
4

When you export you use the compatibility system set to MYSQL40. Worked for me.

3

I had read yesterday that the issue was fixed for someone when that person cleared cookies. I had tried that but it did not work for me.

Checking the following section in DatabaseInterface.class.php,

        define(
            'PMA_MYSQL_INT_VERSION',
            PMA_Util::cacheGet('PMA_MYSQL_INT_VERSION', true)
        );

I figured that somehow cache is the problem. So, I remembered that I was restarting the service instead of doing a start and stop.

# restart the service
systemd restart php-fpm

# start and stop the service
systemd stop php-fpm
systemd start php-fpm

Doing a stop followed by a start fixed the issue for me.

1
  • for the record clearing the cookie did worked for me
    – FR STAR
    Jan 19, 2016 at 5:16
0

Is your MySQL server version 5.5.3 or greater?

The utf8mb4, utf16, and utf32 character sets were added in MySQL 5.5.3.

http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-sets.html

2
  • I am having the issue but the server is at 5.0.x.
    – dknight
    Jan 18, 2014 at 11:36
  • 5.1.x, 5.0.x and below do not have the utf8mb4, utf16 and utf32 character sets. Jan 19, 2014 at 13:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.