Most Frequently Used MySQL Commands – II

By | July 30, 2011

Continuing from the last post I am carring one few more MySQL commands in this post which are mostly related to handling your database, at your web hosting account.

# [mysql dir]/bin/mysql -h hostname -u root -p

Use this command to login (from unix shell), though using -h is not necessary each time.

mysql> create database [databasename];

This commands creates the database as per your desired name.

mysql> show databases;

You can view the List of databases already exists.

mysql> use [db name];

You can switch to your desired database from the current one.

mysql> show tables;

You can use this command to view the list all the tables in the database.

mysql> describe [table name];

To know the formats of fields of a database you should use this command.

mysql> drop database [database name];

If your find out any unnecessary database in your account then you can delete by using the above command.

mysql> drop table [table name];

If you want to delete any particular table from a database then you can use this command.

Note :- Others MySQL commands related to tables will be shared in upcoming posts.