MySQL error Illegal mix of collations

My localhost is working, but I got i failed on the server site. I think that I have more than +200 of this kind of GET connection…But the last page is not working at the server site.

Here some screens:





Local host is working:

All best,
Trolle

Check the exact error as explained here:

Hi Teodor !
That to easy! :smile:
I read your link 2 days ago. It seems the problem is in fetch.js:271.
All best,
Trolle

But what’s the server action error response in the network/xhr?

It this what you are asking for?

Click on the server action in the error and check the response as explained in the docs.

Why not use INNER JOIN in the custom query if thats two different table. What is the FROM user, user_level WHERE doing? why not FROM user WHERE?

I have made a INNER JOIN:

The result is the same. It works locally, but not on the remote server. Same error message fetch.js:271.

Can you just click on the red server action name in the error and check the response please?

Here it is…

Hope you can help!
Trolle

Ok we are almost there … now click response or preview …

Here is a copy from the Preview:

  1. {code: “HY000”, file: “/customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/lib/db/Connection.php”,…}

  2. code: “HY000”

  3. file: “/customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/lib/db/Connection.php”

  4. line: 112

  5. message: “SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation ‘=’”

  6. trace: “#0 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/lib/db/Connection.php(112): PDO->prepare(‘SELECT user.id,…’)\n#1 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/modules/dbupdater.php(411): lib\db\Connection->execute(‘SELECT user.id,…’, Array)\n#2 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/lib/App.php(195): modules\dbupdater->custom(Object(stdClass), ‘custom’, Array)\n#3 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/lib/App.php(127): lib\App->execSteps(Object(stdClass))\n#4 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/lib/App.php(116): lib\App->exec(Object(stdClass), false)\n#5 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/lib/App.php(94): lib\App->exec(Object(stdClass))\n#6 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnect/api/data/useradgang_vis2.php(8): lib\App->define(Object(stdClass))\n#7 {main}”

Here is a copy from the Resonse:

{“code”:“HY000”,“file”:"/customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/lib/db/Connection.php",“line”:112,“message”:“SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation ‘=’”,“trace”:"#0 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/lib/db/Connection.php(112): PDO->prepare(‘SELECT user.id,…’)\n#1 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/modules/dbupdater.php(411): lib\db\Connection->execute(‘SELECT user.id,…’, Array)\n#2 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/lib/App.php(195): modules\dbupdater->custom(Object(stdClass), ‘custom’, Array)\n#3 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/lib/App.php(127): lib\App->execSteps(Object(stdClass))\n#4 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/lib/App.php(116): lib\App->exec(Object(stdClass), false)\n#5 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnectLib/lib/App.php(94): lib\App->exec(Object(stdClass))\n#6 /customers/e/0/6/time2hr.dk/httpd.www/dmxConnect/api/data/useradgang_vis2.php(8): lib\App->define(Object(stdClass))\n#7 {main}"}

Ah now that is what we need, and that is what the tutorial explaining how to debug server side issues explains.

The error returned from your server says that there is a problem with your database table collations. They are different for your 2 tables and they need to be the same. Make sure both use the same collation.

And just to add an image here for others, in MYSQL Workbench this is where the collection for a table can be changed. I would say change them both to (utf8mb4_unicode_ci) if that make sense for you.

Thanks to all of you!
Now it works!

Btw with the latest Wappler, you can change the MySQL table collations also in the Database Manager, in the advanced options of the table