• We just launched and are currently in beta. Join us as we build and grow the community.

Change MySQL Table Collation

pfker36

Social Impact Manager
P Rep
0
0
0
Rep
0
P Vouches
0
0
0
Vouches
0
Posts
138
Likes
144
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 400 XP
In my previous post, I explained on how to Convert MyISAM to InnoDB. This time I’ll show you on how to change the collation of MySQL database tables. BTW, collation controls the way string values are sorted.

This code is useful if the table collation varied from each other. Example one table has utf8_general_ci collation, while the other has utf8_unicode_ci. It’s a best practice if there is uniformity with the table collation to avoid conflict in your data.

Some of the codes in this article are taken from the internet. I just revised some of it so you will benefit from this code.

Be sure to change the following code attached here to fit your needs.

  1. $username

    =

    "root"

    ;
  2. $password

    =

    ""

    ;
  3. $db

    =

    "database"

    ;
  4. $host

    =

    "localhost"

    ;

  5. $target_charset

    =

    "utf8"

    ;
  6. $target_collate

    =

    "utf8_general_ci"

    ;

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.

2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Download
You must upgrade your account or reply in the thread to view hidden text.
 

450,270

322,965

322,974

Top