If this is your first visit, check our documentation. To post, register or login.
Forums / Upgrading to 2.x.x / Problem changing all DB collations to utf8mb3_general_ci

Problem changing all DB collations to utf8mb3_general_ci

Started by kevin_a on 25 Mar 2025, 3:50 PM · Views: 1,440

Results 1 to 12 of 12
25 Mar 2025, 3:50 PM
#1
kevin_a avatar

kevin_a

Zen Follower

Join Date:
Mar 2007
Location:
Worcester UK
Posts:
148
Plugin Contributions:
0

Problem changing all DB collations to utf8mb3_general_ci

I wish to upgrade from 1.5.7c to 2.1
The existing DB for v 1.5.7c has mixed colllation Latin and utf8-comms.
I understand that this existing 155b database needs upgrading to bring all the collations to utf8mb4 before it can be imported to the 2.1 site.

ZenCart v 1.5.7c
PHP 7.4.33
The existing DB forv 1.5.7c has mixed collation.... latin1_general_ci and utf8mb3_general_ci

I have run the tool available for global collation edit (convert_database.php)

I receive the following problem report

"The database's character-set doesn't match DB_CHARSET.
92 tables don't have the same collation as the base database's. These issues can be corrected without a full database conversion.
335 fields don't have the same collation as the base database's. These issues can be corrected without a full database conversion.
108 tables don't have the same collation as the base database's1.
372 fields don't have the same collation as the base database's1.
2 date/datetime/timestamp fields have a zero-date default. This must be corrected before any character-set and/or collation modifications are made to the database."

Is there a missing step that I should address, in order to run the tool?
All help appreciated thanks.

kevin_a

25 Mar 2025, 4:06 PM
#2
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,904
Plugin Contributions:
23

Re: Problem changing all DB collations to utf8mb3_general_ci

If you have cPanel and phpMyAdmin, select the database, navigate to the "Operations" tab, change the collation to utf8mb4_general_ci, and check the options to change all tables and columns to the new collation. Click on Go.

Note the use of 4 versus 3.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

25 Mar 2025, 4:47 PM
#3
kevin_a avatar

kevin_a

Zen Follower

Join Date:
Mar 2007
Location:
Worcester UK
Posts:
148
Plugin Contributions:
0

Re: Problem changing all DB collations to utf8mb3_general_ci

Thanks dbltoe, but that did not make any change.
Still a mix of latinxxx and utfxxxx?

kevin_a

25 Mar 2025, 4:49 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: Problem changing all DB collations to utf8mb3_general_ci

What is the DB_CHARSET value set in /includes/configure.php?

25 Mar 2025, 5:22 PM
#5
kevin_a avatar

kevin_a

Zen Follower

Join Date:
Mar 2007
Location:
Worcester UK
Posts:
148
Plugin Contributions:
0

Re: Problem changing all DB collations to utf8mb3_general_ci

define('DB_TYPE', 'mysql'); // always 'mysql'
define('DB_PREFIX', ''); // prefix for database table names -- preferred to be left empty
define('DB_CHARSET', 'utf8mb4'); // 'utf8mb4' or older 'utf8' / 'latin1' are most common
define('DB_SERVER', 'localhost'); // address of your db server

kevin_a

25 Mar 2025, 5:37 PM
#6
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Re: Problem changing all DB collations to utf8mb3_general_ci

in phpmyadmin select the check all and in the "with selected" dropdown choose analyze table.
Default global setting for "information schema stats expiry" is 86400 seconds, so changes are not always apparent immediately until the cache expires (if the server is using MySQL 8.0)
So you have to force it to invalidate the cache of stats

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

25 Mar 2025, 5:52 PM
#7
kevin_a avatar

kevin_a

Zen Follower

Join Date:
Mar 2007
Location:
Worcester UK
Posts:
148
Plugin Contributions:
0

Re: Problem changing all DB collations to utf8mb3_general_ci

Thank you barco
Unfortunately I do not see a button facilitating check/select all tables, ?
Where in the menu structure or elsewhere should I find it?

kevin_a

25 Mar 2025, 5:55 PM
#8
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Re: Problem changing all DB collations to utf8mb3_general_ci

when you have your database open in phpmyadmin, scroll to the bottom, and there is the check all to select all tables in your database and then the dropdown is right next to that
Attachment 20938

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

25 Mar 2025, 6:11 PM
#9
kevin_a avatar

kevin_a

Zen Follower

Join Date:
Mar 2007
Location:
Worcester UK
Posts:
148
Plugin Contributions:
0

Re: Problem changing all DB collations to utf8mb3_general_ci

Ok thanks barco
I ran Analyse selected (all) and the reply was "Table is already up to date" in every case.
However, structure tab lists mix latin1/ utf8mb3 / utf8mb4 ?

kevin_a

25 Mar 2025, 6:50 PM
#10
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Re: Problem changing all DB collations to utf8mb3_general_ci

well, that confirms that the "convert_database.php" didn't do the conversion.

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

25 Mar 2025, 7:34 PM
#11
kevin_a avatar

kevin_a

Zen Follower

Join Date:
Mar 2007
Location:
Worcester UK
Posts:
148
Plugin Contributions:
0

Re: Problem changing all DB collations to utf8mb3_general_ci

Success.
Thanks for all the suggestions.
I have now re-run file convert_database.php
and retraced steps, and this time it worked successfully, and converted all to utf8mb4_general_ci
which was a successful outcome.

kevin_a

25 Mar 2025, 7:35 PM
#12
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Problem changing all DB collations to utf8mb3_general_ci

Thanks for confirming your success!

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.