Alter all tables in mysql database

Standard
USE INFORMATION_SCHEMA;
SELECT 
CONCAT("ALTER TABLE `", TABLE_SCHEMA,"`.`", TABLE_NAME, "` CONVERT TO CHARACTER SET UTF8;") 
AS MySQLCMD FROM TABLES 
WHERE TABLE_SCHEMA = "dbname";

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.