SQLgrey encountered an SQL error ...

Report bugs and workarounds
nicola.piazzi
Posts: 388
Joined: 23 Apr 2015 09:45

(SOLVED) Re: SQLgrey encountered an SQL error ...

Post by nicola.piazzi »

USE sqlgrey;
SHOW VARIABLES LIKE '%collation%';
+----------------------+--------------------+
| Variable_name | Value |
+----------------------+--------------------+
| collation_connection | utf8_general_ci |
| collation_database | latin1_swedish_ci |
| collation_server | utf8mb4_unicode_ci |
+----------------------+--------------------+

As you can see sqlgrey create its own database in latin1 but now with mariadb EFA uses utf8 connection, this give the error : Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE)

Other DB in EFA are altrady utf8

We need to change database, but also tables and columns to be compatible with connection
Here sequence , worked for me
You can do it without problem


mysql -u root -pXXXXXXXXXXXXXX
USE sqlgrey;

ALTER DATABASE sqlgrey CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';

ALTER TABLE config CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
ALTER TABLE connect CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
ALTER TABLE domain_awl CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
ALTER TABLE from_awl CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
ALTER TABLE optin_domain CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
ALTER TABLE optin_email CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
ALTER TABLE optout_domain CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
ALTER TABLE optout_email CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';


ALTER TABLE config MODIFY parameter varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE config MODIFY value varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

ALTER TABLE connect MODIFY sender_name varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE connect MODIFY sender_domain varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE connect MODIFY src varchar(39) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE connect MODIFY rcpt varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

ALTER TABLE domain_awl MODIFY sender_domain varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE domain_awl MODIFY src varchar(39) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

ALTER TABLE from_awl MODIFY sender_name varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE from_awl MODIFY sender_domain varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE from_awl MODIFY src varchar(39) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

ALTER TABLE optin_domain MODIFY domain varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

ALTER TABLE optin_email MODIFY email varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

ALTER TABLE optout_domain MODIFY domain varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

ALTER TABLE optout_email MODIFY email varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
gh0stwizard
Posts: 4
Joined: 04 Jul 2019 08:54

Re: (SOLVED) Re: SQLgrey encountered an SQL error ...

Post by gh0stwizard »

nicola.piazzi wrote: 09 Apr 2019 08:05 Here sequence , worked for me
Thank you! This works for me too.
brock
Posts: 2
Joined: 11 Sep 2014 14:41

Re: SQLgrey encountered an SQL error ...

Post by brock »

Many thanks, this work for me too.
User avatar
pdwalker
Posts: 1553
Joined: 18 Mar 2015 09:16

Re: SQLgrey encountered an SQL error ...

Post by pdwalker »

Nicola to the rescue, yet again!
Post Reply