Welcome, Guest. Please login or register.

ShoutBox!

 

Skhilled

2024-08-09, 18:19:29
Awww! Poor thing! LOL
 

Ken

2024-08-09, 09:20:52
 

Skhilled

2024-07-06, 10:33:18
 :D
 

Ken

2024-07-06, 06:40:47
Happy Saturday after the 4th of July!
 :fireworks:
 

Skhilled

2024-07-04, 20:27:02
Happy Day Off From Work!  :D
 

Ken

2024-06-25, 06:23:12
84... who knew?  laughing7
...2013 was my *magic* year
 

Skhilled

2024-06-14, 22:09:12
I hope so! LOL
 

Ken

2024-06-14, 21:41:30
My B-Day is forthcoming and maybe it will be far enough along so that I can be a regular Dancing Fool for that day!!! :banana: :2funny:
 

Ken

2024-06-14, 21:38:38
Happy Friday everyone! I'm  SOOO glad to see Friday and not just because it's the weekend, but because it marks one more day in the recovery of my foot!  laughing7

Scrubmeister

2024-04-19, 10:32:40
Good to see the site back faster than ever. :)

Recent Topics

TP Articles


Search in titles
Search in article texts

Author Topic: Changing Database Collations  (Read 2572 times)

0 Members and 1 Guest are viewing this topic.

Offline Skhilled (OP)

  • Administrator
  • *
  • Posts: 9424
  • Gender: Male
  • All of my passwords are protected by amnesia...
  • View Gallery
    • Buildz Hosting
Changing Database Collations
« on: February 12, 2012, 06:40:34 AM »
Database collations relate to how a database views and displays various language characters. For instance, an all English collation will not display accented characters in other languages well such as "?, ?, ?, etc". For the most part, all collations should always be the same. To tell what your particular server collations are you should look in phpmyadmin or ask your hosting.

Different servers may have different collations while some will have the same. When you install software on a server (such as SMF) or add mods, themes, etc. from within a program such as SMF they will be installed and set to whatever collation the default is for the server.

Problems arise if you change hosting or move to another server that does not have the same collations. A previous server you were on may have had "utf8_general_ci" as the default and the new server that you just moved to may be set to "latin1_swedish_ci".

Installing things on the old server will give you "utf8_general_ci" collations. But after the move anything you install, such as a mod, will give you "latin1_swedish_ci". When you view your database in phpmyadim you will see "mixed" collations some for one and some for the other. The more you change hostings and encounter different collations you will get even more mixed collations.

The point is: mixed collations can cause problems for your mods and you'll may never know why.

Here are 2 easy ways to fix this:

1. Use the following script by making the necessary changes described below and uploading it to the root folder of your forum:

Code: [Select]
<?php
$db 
mysql_connect('localhost','myuser_mydbuser','mypassword');
if(!
$db) echo "Cannot connect to the database - incorrect details";
mysql_select_db('myuser_mydbname'); $result=mysql_query('show tables');
while(
$tables mysql_fetch_array($result)) {
foreach (
$tables as $key => $value) {
mysql_query("ALTER TABLE $value COLLATE utf8_general_ci");
}}
echo 
"The collation of your database has been successfully changed!";
?>


Make sure to substitute in the above script:

- myuser_mydbname with your database name;

- myuser_mydbuser with your mysql username;

- mypassword with your password for the mysql user;

- utf8-general_ci with your new collation if different;

2.  Download: Phoca Changing Collation Tool