-- Step 1: Run the following sql to get ALTER queries for all tables
SELECT CONCAT('ALTER TABLE `', tbl.`TABLE_SCHEMA`, '`.`', tbl.`TABLE_NAME`, '` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;') FROM `information_schema`.`TABLES` tbl WHERE tbl.`TABLE_SCHEMA` = ‘YOURDBNAME';
-- Step 2: Disable foreign key checks (Skip this step if you are not use any foreign keys in your project)
SET foreign_key_checks = 0;
-- Step 3: Run all ALTER queries from step 1
-- Step 4: Enable foreign key checks (Skip this step if you are not use any foreign keys in your project)
SET foreign_key_checks = 1;
This snippets is use to convert all tabless & columns charset to utf8_general_ci
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.