Welcome, Guest. Please login or register.

ShoutBox!

Scrubmeister

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

Skhilled

2024-04-18, 21:09:09
I've upgraded the server...more resources. ;)
 

Ken

2024-04-18, 20:57:10
Now that you mention it...  :D
 

Skhilled

2024-04-18, 20:47:19
...and, you should notice that the site is much faster.  :o
 

Ken

2024-04-18, 20:31:37
Hey Steve.
 

Skhilled

2024-04-18, 17:56:10
Re-read the message below...
 

Skhilled

2024-03-31, 15:22:06
Oh yeah, you need to upgrade the site first...
 

Ken

2024-03-30, 09:54:54
Whoops! I forgot that the SMF install here on OFF is out of date!  :'(
 

Ken

2024-03-30, 09:44:48
 Conga-Rats Steve!  :thumbup:
Me gonna install it here just for the fun of it!  :)
 

Skhilled

2024-03-29, 22:15:23
Released!  :D

Recent Topics

TP Articles


Search in titles
Search in article texts

Author Topic: Changing Database Collations  (Read 1948 times)

0 Members and 1 Guest are viewing this topic.

Offline Skhilled

  • Administrator
  • *
  • Posts: 9007
  • Gender: Male
  • All of my passwords are protected by amnesia...
    • 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