默认情况下,我的所有表和列都处于一些奇怪的排序规则(latin1_swedish_ci)。我想将它们更改为" utf8_unicode_ci"但由于我有100个表和许多列,我想用一个命令来做这个。有谁知道怎么做?
答案 0 :(得分:0)
您可以在PHP
:
$con = mysql_connect('server_name','user_name','password');
mysql_select_db('database_name');
$result = mysql_query('show tables');
while($tables = mysql_fetch_array($result)) {
foreach ($tables as $key => $table_name) {
mysql_query('alter table $table_name convert to character set utf8 collate utf8_general_ci');
}}