MySQL info - create DBs/InnoDB/charsets etc.
Posted by gregster on 06 Feb 2007 in Servers, Documentation
Creating a DB in MySQL (phpMyAdmin)
1) make sure that the collation type is set to utf8_unicode_ci
2) tables should be created in this format. (Note that the engine is InnoDB not MyISAM. MySQL will want to create MyISAM tables. This is OK, but we've settled on InnoDB for its more sophisticated transaction locking and journaling.)
CREATE TABLE `foo` ( `field1` varchar(55) collate utf8_unicode_ci NOT NULL, `field2` varchar(55) collate utf8_unicode_ci NOT NULL, `field3` varchar(55) collate utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;3) dumps from phpMyAdmin will export tables as latin1 because of the way that MySQL was configured when being built. See here for documentation. To restore/import, first change all refs in the .sql dump file from latin1 to utf8. 4) phpMyAdmin does not seem to set a BOM on the files it creates (this is just FYI - we aren't sure if it matters). It (phpMyAdmin may also be encoding the characters as ANSI (this is Martin's experience on Windows. It seems to give me utf8 on Linux, but ...).