MySQL: Create Database

  • Replace {db} with the name of the database.
  • Replace {user} with the name of the user.

Create Database

CREATE DATABASE IF NOT EXISTS `{db}`;

Create Database and Grant Rights to a User

CREATE DATABASE IF NOT EXISTS `{db}`;
GRANT ALL PRIVILEGES ON `{db}` . * TO '{user}'@'%';