How to Disable MySQL Strict Mode

To disable strict SQL mode, SSH in to your server as root and create this file:

/etc/mysql/conf.d/disable_strict_mode.cnf

Open the file and enter these two lines:

[mysqld]
sql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Restart MySQL with this command:

sudo service mysql restart

To verify that the process was completed properly you can run the following:

mysql -e "SELECT @@sql_mode;"

MYSQL Create databases

Pre-Flight Check
  • These instructions are intended for creating a MySQL database on Linux via the command line.
  • I’ll be working from a Liquid Web Core Managed CentOS 6.5 server, and I’ll be logged in as root.
Create a MySQL Database

First we’ll login to the MySQL server from the command line with the following command:

mysql -u root -p

In this case, I’ve specified the user root with the -u flag, and then used the -p flag so MySQL prompts for a password. Enter your current password to complete the login.

If you need to change your root (or any other) password in the database, then follow this tutorial on changing a password for MySQL via the command line.

You should now be at a MySQL prompt that looks very similar to this:

mysql>

To create a database with the name tutorial_database type the following command:

CREATE DATABASE tutorial_database;

If a database of the same name already exists, then a new database will not be created and you’ll receive this error:

ERROR 1007 (HY000): Can't create database 'tutorial_database'; database exists

To avoid seeing this error use the following command instead:

CREATE DATABASE IF NOT EXISTS tutorial_database;

The above command will only create the database tutorial_database if a database of that name does not already exist.

View All MySQL Databases

To view the database you’ve created simply issue the following command:

SHOW DATABASES;

Your result should be similar to this:

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
| tutorial_database  |
+--------------------+
4 rows in set (0.00 sec)