Database & Table Creation: MySQL console (commands/Queries)


Basic Tutorial to illustrate mysql console: create database and tables. Desc Tables; show tables; show databases;

Left click, as well as right click on the WAMP/XAMP/MAMP/XAMPP icon in your task bar and see the options.
MySQL console will be present under the MySQL folder.

Usually your local installation of MySQL will have username as root and there will be no password. If you’re trying this on your commercial server, then make sure to use your correct username and password.

Video Tutorial: Database & Table Creation: MySQL console (commands/Queries)

You need to a flashplayer enabled browser to view this YouTube video

YouTube Link: [Watch the Video In Full Screen.]

Database Creation

mysql> CREATE DATABASE software;

CREATE DATABASE are keywords.
software is the name given by us to the new database;

mysql> show databases;

This query / command would list all the databases present inside our MySQL installation.

mysql> use software;

This query / command tells which database we will be working on from now.

mysql> show tables;

This query / command would list all the tables present inside the database we are using or working on.

mysql> CREATE table Apple(id int, name varchar(20));

This would create a table by name Apple, which has two fields id and name.
Here id is of integer type: default size 11.
and name is of type varchar which is of size 20 – user allocated and its not default.

mysql> desc Apple;

This would show the description or the structure of the table Apple.

Leave a Reply

Your email address will not be published. Required fields are marked *