Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8330209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:03:08+00:00 2026-06-09T02:03:08+00:00

Error message on MySql: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ‘=’

  • 0

Error message on MySql:

Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='

I have gone through several other posts and was not able to solve this problem.
The part affected is something similar to this:

CREATE TABLE users (
    userID INT UNSIGNED NOT NULL AUTO_INCREMENT,
    firstName VARCHAR(24) NOT NULL,
    lastName VARCHAR(24) NOT NULL,
    username VARCHAR(24) NOT NULL,
    password VARCHAR(40) NOT NULL,
    PRIMARY KEY (userid)
) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci;

CREATE TABLE products (
    productID INT UNSIGNED NOT NULL AUTO_INCREMENT,
    title VARCHAR(104) NOT NULL,
    picturePath VARCHAR(104) NULL,
    pictureThumb VARCHAR(104) NULL,
    creationDate DATE NOT NULL,
    closeDate DATE NULL,
    deleteDate DATE NULL,
    varPath VARCHAR(104) NULL,
    isPublic TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',
    PRIMARY KEY (productID)
) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci;

CREATE TABLE productUsers (
    productID INT UNSIGNED NOT NULL,
    userID INT UNSIGNED NOT NULL,
    permission VARCHAR(16) NOT NULL,
    PRIMARY KEY (productID,userID),
    FOREIGN KEY (productID) REFERENCES products (productID) ON DELETE RESTRICT ON UPDATE NO ACTION,
    FOREIGN KEY (userID) REFERENCES users (userID) ON DELETE RESTRICT ON UPDATE NO ACTION
) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci;

The stored procedure I’m using is this:

CREATE PROCEDURE updateProductUsers (IN rUsername VARCHAR(24),IN rProductID INT UNSIGNED,IN rPerm VARCHAR(16))
BEGIN
    UPDATE productUsers
        INNER JOIN users
        ON productUsers.userID = users.userID
        SET productUsers.permission = rPerm
        WHERE users.username = rUsername
        AND productUsers.productID = rProductID;
END

I was testing with php, but the same error is given with SQLyog.
I have also tested recreating the entire DB but to no good.

Any help will be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T02:03:10+00:00Added an answer on June 9, 2026 at 2:03 am

    The default collation for stored procedure parameters is utf8_general_ci and you can’t mix collations, so you have four options:

    Option 1: add COLLATE to your input variable:

    SET @rUsername = ‘aname’ COLLATE utf8_unicode_ci; -- COLLATE added
    CALL updateProductUsers(@rUsername, @rProductID, @rPerm);
    

    Option 2: add COLLATE to the WHERE clause:

    CREATE PROCEDURE updateProductUsers(
        IN rUsername VARCHAR(24),
        IN rProductID INT UNSIGNED,
        IN rPerm VARCHAR(16))
    BEGIN
        UPDATE productUsers
            INNER JOIN users
            ON productUsers.userID = users.userID
            SET productUsers.permission = rPerm
            WHERE users.username = rUsername COLLATE utf8_unicode_ci -- COLLATE added
            AND productUsers.productID = rProductID;
    END
    

    Option 3: add it to the IN parameter definition (pre-MySQL 5.7):

    CREATE PROCEDURE updateProductUsers(
        IN rUsername VARCHAR(24) COLLATE utf8_unicode_ci, -- COLLATE added
        IN rProductID INT UNSIGNED,
        IN rPerm VARCHAR(16))
    BEGIN
        UPDATE productUsers
            INNER JOIN users
            ON productUsers.userID = users.userID
            SET productUsers.permission = rPerm
            WHERE users.username = rUsername
            AND productUsers.productID = rProductID;
    END
    

    Option 4: alter the field itself:

    ALTER TABLE users CHARACTER SET utf8 COLLATE utf8_general_ci;
    

    Unless you need to sort data in Unicode order, I would suggest altering all your tables to use utf8_general_ci collation, as it requires no code changes, and will speed sorts up slightly.

    UPDATE: utf8mb4/utf8mb4_unicode_ci is now the preferred character set/collation method. utf8_general_ci is advised against, as the performance improvement is negligible. See https://stackoverflow.com/a/766996/1432614

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following error message: SQLSTATE[HY000] [2003] Can't connect to MySQL server on
When connecting to mysql, I have functions to get the relevant error message and
I've got this error: Fatal error: Uncaught exception 'MySQLiQuery_Exception' with message 'Illegal mix of
Error message doesn't display on mysql connect failure if( ! $this->remote_connection_id = @mysql_connect($vars['hostname'], $vars['username'],
Full error message: You have an error in your SQL syntax; check the manual
The error message I got: You have an error in your SQL syntax; check
I am trying to return user friendly error message when a Mysql Exception is
Getting a MySQL error message when I try to insert a text message from
I'm getting this error message every 10 seconds. 2011-02-09 05.54.37 com.apple.launchd.peruser.501[153] (com.mysql.mysqld) Throttling respawn:
I have got this error message: #2002 - The server is not responding (or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.