ejakabo, greetz from russian ipboard community, we have exactly what you need =) 1) For average sized forums - database conversion script based on PHP: <?php
// Database info
include("conf_global.php");
$dbhost = $INFO['sql_host'];
$dbuser = $INFO['sql_user'];
$dbpass = $INFO['sql_pass'];
$dbname = $INFO['sql_database'];
//---------------
header('Content-type: text/plain');
$dbconn = mysql_connect($dbhost, $dbuser, $dbpass) or die( mysql_error() );
$db = mysql_select_db($dbname) or die( mysql_error() );
$sql = "ALTER DATABASE `".$dbname."` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci";
$result = mysql_query($sql) or die( mysql_error() );
print "Database changed to UTF-8.\n";
$sql = 'SHOW TABLES';
$result = mysql_query($sql) or die( mysql_error() );
while ( $row = mysql_fetch_row($result) )
{
$table = mysql_real_escape_string($row[0]);
$sql = "ALTER TABLE $table DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci, CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci";
mysql_query($sql) or die( mysql_error() );
print "$table changed to UTF-8.\n";
}
mysql_close($dbconn);
?>
Upload this script as "any_name_you_like.php" in forum's root folder and execute. Be careful with large databases - be sure to correctly configure max_execution_time limit.
2) For large forums - 2 step conversion:
Step 1:
<?php
// Database info
include("conf_global.php");
$dbhost = $INFO['sql_host'];
$dbuser = $INFO['sql_user'];
$dbpass = $INFO['sql_pass'];
$dbname = $INFO['sql_database'];
//---------------
header('Content-type: text/plain');
$dbconn = mysql_connect($dbhost, $dbuser, $dbpass) or die( mysql_error() );
$db = mysql_select_db($dbname) or die( mysql_error() );
$sql = "ALTER DATABASE `".$dbname."` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;\n";
$exec_sql = 'SHOW TABLES';
$result = mysql_query($exec_sql) or die( mysql_error() );
while ( $row = mysql_fetch_row($result) )
{
$table = mysql_real_escape_string($row[0]);
$sql .= "ALTER TABLE `".$table."` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci, CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;\n";
}
mysql_close($dbconn);
echo $sql;
As in first method, upload this script into forum's root folder and execute. Follow it's URL and you'll get a mysql dump file. Save it, for example, as win2utf.sql and upload to /somewhere/at/server
Step 2:
Connect to your sever throught SSH and run:
#mysql -uusername -p dbname < /somewhere/at/server/win2utf.sql
Thats it. More info and russian support topics: 1, 2. Always make a backup before performing any operations with database!