
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Set the default character set in MySQL
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)
- Related Articles
- Change MySQL default character set to UTF-8 in my.cnf?
- How do I find out the default server character set in MySQL?
- How to set default Field Value in MySQL?
- How to set MySQL default value NONE?
- Display only the default values set for columns in MySQL
- How to set default value to NULL in MySQL?
- Set default value to a JSON type column in MySQL?
- How to set default value for empty row in MySQL?
- How do I set the default value for a column in MySQL?
- Set DEFAULT values for columns while creating a table in MySQL
- Creating a Table in MySQL to set current date as default
- How can we produce a string, other than default binary string, in a given character set by MySQL CHAR() function?
- How to set NOW() as default value for datetime datatype in MySQL?
- How to set default date time as system date time in MySQL?
- Match any single character in the given set.

Advertisements