Geekpedia Forums Logo

Create a MySQL Database

by Alejandro Gil on Monday, July 16th - 5:53 AM



Hi, how can i create a MySQL database with code, not with a database tool?.
Thx

Hi,

You might want to try out the following syntax when you are in the MYSQL command line mode.

1. If you are sure that the database does not exist.

CREATE DATABASE your_database_name;

2. If you are NOT sure whether the database exist.

CREATE DATABASE IF NOT EXISTS your_database_name;

Thanx.
I made it listing all databases of a server and check one by one , this command is better :P, more thanx.