MySQL - CREATE Database Command in Terminal - Console [ SHOW SELECT DROP USE ]

Опубликовано: 14 Март 2013
на канале: Davids Videos
46,833
212

In this tutorial, the self-taught developer explains how to create, drop, select, show, and use databases on a MySQL server using on the terminal.

It probably one of the simplest commands to know in the MySQL syntax, and also one of the least used commands.

I am how often is it that you decide to create a database.

So you can create a database, by simply giving the command:

CREATE DATABASE database_name;

Then to use the database:

USE database_name;

By giving the USE command, you are telling MySQL that every command which you use does not have a database prefix database.table_name then it should assume that you mean the database which you have declared.

To delete the database, you should issue the following command:

DROP DATABASE database_name;

By aware, that this deletes all tables with it, therefore if you have data in some tables which you need then, make certain to back up this data prior to dropping the database,

You can always, tell which database you are currently using, by issuing the command:

SELECT DATABASE();

This will list out the one single database which you have selected or are using.

If you haven't selected a database to use, then it will display NULL

You can get a list of all databases on this one server by issuing the command:

SHOW DATABASES;

This will then list out all databases on the server.

#SelfTaughtDeveloper #DavidThorn