MySQL Create Database with UTF8 Character Set Syntax


Posted by Andrew McCombe on Fri Jun 21, 2013

I always forget the MySQL create database with UTF8 character set syntax, so here it is:

Alternatively, you can use ‘CREATE SCHEMA’ instead of ‘CREATE DATABASE’:

I hope this helps someone else too!

UPDATE: This post used to show the FLUSH PRIVILEGES command after the GRANT statements but, as pointed out by Scott Lindsey in the comments, FLUSH PRIVILEGES is unnecessary. For information why this isn’t needed, please refer to this article by Jaime Crespo at dbahire.com.