# Sql\_upgrade issue from 2.9.0

**URL:** <https://community.open-emr.org/t/sql-upgrade-issue-from-2-9-0/5519>\
**Category:** OpenEMR Development\
**Created:** [May 19, 2013, 1:36am UTC](https://community.open-emr.org/t/sql-upgrade-issue-from-2-9-0/5519 "2013-05-19T01:36:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [May 19, 2013, 1:36am UTC](https://community.open-emr.org/t/sql-upgrade-issue-from-2-9-0/5519/1 "2013-05-19T01:36:25Z")

</div>

**[tmccormi](https://sourceforge.net/u/tmccormi/)** wrote on [Sunday, May 19, 2013](https://sourceforge.net/p/openemr/discussion/202506/thread/40576822/#8e14):

I ran across this issue in an upgrade from 2.9.0 data to 4.1.1.

> ERROR: query failed: UPDATE `billing`, `code_types`, `temp_table_one` SET temp\_table\_one.code\_type=billing.code\_type, temp\_table\_one.code=billing.code, temp\_table\_one.modifier=billing.modifier WHERE billing.code\_type=code\_types.ct\_key AND code\_types.ct\_fee=1 AND temp\_table\_one.pid=billing.pid AND temp\_table\_one.encounter=billing.encounter AND billing.activity!=0
> 
> Error: Illegal mix of collations (utf8\_unicode\_ci,IMPLICIT) and (utf8\_general\_ci,IMPLICIT) for operation ‘=’

I tried dumping and recreating the table insuring utf-8 setting, but that did not help. There were only 21 records in the table so I emptied it for now to get past it.

Any thoughts from the SQL guru’s out there?

–Tony

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [May 19, 2013, 7:24am UTC](https://community.open-emr.org/t/sql-upgrade-issue-from-2-9-0/5519/2 "2013-05-19T07:24:14Z")

</div>

**[bradymiller](https://sourceforge.net/u/bradymiller/)** wrote on [Sunday, May 19, 2013](https://sourceforge.net/p/openemr/discussion/202506/thread/40576822/#d2d3):

Hi Tony,

This is likely because you have a “hybrid” database for your collation. Some international users have reported this issue also. Your original database was likely set to utf8\_general\_ci, which is the default when you ran setup.php(although pre 3.1 may of actually had some utf8 encoding mixed with latin1 per the link below). However, if you then placed this database within another database shell that defaults to utf8\_unicode\_ci, then new sql columns that are added that will use the utf8\_unicode\_ci collation, which can then break certain queries. Should be able to change the collation settings in phpmyadmin to ensure they are all the same.

Here’s a pertinent link for 3.1 when converted OpenEMR database to 100% pure UTF8 encoding:  
[http://www.open-emr.org/wiki/index.php/OpenEMR\_UTF-8\_Upgrade\_Howto](http://www.open-emr.org/wiki/index.php/OpenEMR_UTF-8_Upgrade_Howto)

After some discussion via email with an international user and Rod, think it would make a lot of sense to have a Administration-\>Diagnostics script/gui that did some basic testing with one of the tests ensuring that a hybrid encoding/collation mysql does not exist and that the current default settings of the database match the current entries (in addition to a bunch of likely other useful dx tests such as orphaned data/files etc).

-brady  
[OpenEMR](http://www.open-emr.org/)

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [May 19, 2013, 7:27am UTC](https://community.open-emr.org/t/sql-upgrade-issue-from-2-9-0/5519/3 "2013-05-19T07:27:53Z")

</div>

**[bradymiller](https://sourceforge.net/u/bradymiller/)** wrote on [Sunday, May 19, 2013](https://sourceforge.net/p/openemr/discussion/202506/thread/40576822/#7c3c):

Hi,  
Also, which table did you empty to get it to work?  
-brady  
[OpenEMR](http://www.open-emr.org/)

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [September 24, 2013, 3:52pm UTC](https://community.open-emr.org/t/sql-upgrade-issue-from-2-9-0/5519/4 "2013-09-24T15:52:17Z")

</div>

**[rayaz](https://sourceforge.net/u/rayaz/)** wrote on [Tuesday, September 24, 2013](https://sourceforge.net/p/openemr/discussion/202506/thread/40576822/#84f4):

Hi there,

Just upgraded from ver 4.0. to ver 4.1.2 on an Ubuntu 12.04 server. Have come up with this problem: Error: Illegal mix of collations (utf8\_general\_ci,IMPLICIT) and (utf8\_unicode\_ci,IMPLICIT) for operation ‘=’  
Any help?

Rayaz
