For the default character set, let us see the syntax −
CREATE DATABASE IF NOT EXISTS yourDatabaseName DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
Let us implement the above syntax to set the default character set UTF8 −
mysql> CREATE DATABASE IF NOT EXISTS instant_app -> DEFAULT CHARACTER SET utf8 -> DEFAULT COLLATE utf8_general_ci; Query OK, 1 row affected, 1 warning (0.13 sec)
Now check the status of above created database −
mysql> show create database instant_app;
Output
This will produce the following output −
+-------------+----------------------------------------------------------------------+ | Database | Create Database | +-------------+----------------------------------------------------------------------+ | instant_app | CREATE DATABASE `instant_app` /*!40100 DEFAULT CHARACTER SET utf8 */ | +-------------+----------------------------------------------------------------------+ 1 row in set (0.03 sec)