Latest news
Home » SQL » Change db collation of all tables in mysql

Change db collation of all tables in mysql

SELECT CONCAT( 'ALTER TABLE `', t.`TABLE_SCHEMA` , '`.`', t.`TABLE_NAME` , '` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;' ) AS stmt
FROM `information_schema`.`TABLES` t
WHERE 1
AND t.`TABLE_SCHEMA` = ''
ORDER BY 1
LIMIT 0 , 50

Above mysql query generate Alter table commands for the specified database. Run these sql statement as group.

Leave a Reply

x

Check Also

zend mysql between query

$aEventsSelect = Engine_Api::_()->getItemTable(‘event’)->select(); if(count($aEventIds) > 0){ $aEventsSelect->where(“event_id IN (?)”, $aEventIds); } if( $filter == “past” ...