Create Database

Creating a MySQL Database


You need to have root access to the database, or a user that has been specifically granted permissions to create a database.


Creating a new database in MySQL can be done simply by using the create database command.

create database motorrobot;

This will create a database called motorrobot, which has no specified permissions at the moment, only the root user has access and control over it. It also has no tables. You can see the database now with the show databases command.

show databases;
create database beer;
grant all on beer.* to beer@localhost identified by 'beer';
flush privileges;