Guides:SQL/How do I/Create and Delete a Database

From CoderGuide

Jump to: navigation, search

Return to the SQL How Do I Index

Creating a database is very simple:

CREATE DATABASE database_name;

Note: Do not use a hyphen (a '-') in your database or table names, otherwise you'll have issues. Numbers, letters, and underscores are fine.

Deleting (removing) a database is just as easy:

DROP DATABASE database_name;

Don't forget to use quit; command if you want to exit the MySQL client!

If you'd like to see a list of all databases in your SQL server, use:


If you're using Microsoft's SQL server, see Guides:SQL/How_do_I/Get_Database_and_Table_Information_in_a_Microsoft_SQL_Server.

Keep in mind your MySQL server will already have a few tables created for storing information on users and access permissions.

Personal tools