Change all mysql tables collation to utf8

Create a php file in your public_html and run it.

  1. <?php
  2. $db = mysql_connect('localhost','db_username','db_password');
  3. if(!$db) echo "Cannot connect to the database - incorrect details";
  4. mysql_select_db('database_name'); $result=mysql_query('show tables');
  5. while($tables = mysql_fetch_array($result)) {
  6. foreach ($tables as $key => $value) {
  7. mysql_query("ALTER TABLE $value COLLATE utf8_general_ci");
  8. }}
  9. echo "The collation of your database has been successfully changed!";
  10. ?>
  11. [/php]


Article Information
Article ID Categories Tags Levels Status
#37
Free
Solved