Skip to content

Instantly share code, notes, and snippets.

@necenzurat
Created August 29, 2012 23:06
Show Gist options
  • Save necenzurat/3520079 to your computer and use it in GitHub Desktop.
Save necenzurat/3520079 to your computer and use it in GitHub Desktop.
a script that changes all collations to utf8_general_ci
<?php
/*
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
USAGE: please use the commandline (time limit shit)
php script.php
*/
$db = mysql_connect('localhost','myuser_mydbuser','mypassword');
if(!$db) echo "db shit wrong";
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 "i always hated latin1_swedish_ci, it's done!";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment