TLingC's Zone
TLingC's Zone


文章归档

利用PHP把MySQL数据库内所有表编码转换为utf8mb4

<?php $mysql = mysql_connect(MYSQL_HOST,MYSQL_USERNAME,MYSQL_PASSWORD); if (!$mysql) echo "Failed to connect mysql!"; mysql_select_db(MYSQL_DBNAME,$mysql); $result = mysql_query("SHOW TABLE STATUS"); while($row = mysql_fetch_row($result)) { mysql_query("ALTER TABLE " . $row[0] . " CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci"); } ?>

698   2018-02-22