-- find table with collation wich diffirent from ut8_unicode_ci
SELECT
CONCAT('ALTER TABLE ', TABLE_NAME, ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;')
FROM
information_schema.TABLES
WHERE
table_schema='<database_name>' AND table_collation != 'utf8_unicode_ci'
GROUP BY TABLE_NAME;
-- command will show you queries like this:
ALTER TABLE <table1> CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE <table2> CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE <table3> CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
-- execute this queries manually and all tables will change collation
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.