MySql Command Prompt-Tips and Tricks.

Hello Friends,

This is another tutorial for some of the basic points to remember for using MySQL Database.

MySQL is a client-server Database management system, and so to use MySQL we need a client, an application that we will use to interact with MySQL is its command prompt.(giving it commands to be executed).

Every MySQL installation comes with a simple command-line utility called mysql. This utility does not have any drop-down menus, fancy user interfaces, mouse support, or anything like that. Typing mysql at your operating system command prompt (run/win+r)  brings up a simple prompt that looks like this-

CMD Prompt

This is just a simple command prompt of XP.  Now just type mysql and click ok. Then a new command window will be prompted which will look something like shown below. Then it will ask you for the password. Enter the same password you saved during configuration.

Enter Password


Tips and Points to remember:

• If you just type mysql by itself (i.e. mysql> mysql; ),you might receive an error message.This will likely be because security credentials are needed or because MySQL is not running locally or on the default port. The error will be as-

Error Screen

• The mysql accepts an array of command-line parameters you can use to perform certain operations. For example to create a database we use-


mysql> create database nikhildb;


here “create database dbName” is like an array of commands.

• Now the question arises that where is the data actually resides that is create on mysql using command promt? For example if we take above example to create DB then where actually the DB is stored. the path where DB and other things are stored is ->

C:Program FilesMySQLMySQL Server 5.0data

Stored Path


Here’s the database we just created. All other operations we perform just like creating tables and filling information in it will be stored inside the database unless you create another DB.

Some of the basic tips are as follows-

1) Commands are typed after the mysql> prompt for e.g.-


mysql> create database nikhildb;



mysql> create table TableName;


2) All the commands must end with ” ; ” or ” g; “. In other words, just pressing Enter will not execute the command.

Create DB

Here in above case, the first statement is written without semi-colon so there is no error but even there is no execution of the command. Whereas in second case we wrote the same statement  followed by a semi-colon and the statement is executed.

3) Type help or h to get the help from MySql itself. You can also provide additional text to obtain help on specific commands (for example, help select to obtain help on using the SELECT statement).

Help Text


4) Following are some of the commands used in MySql.

SQL Commands

5) Type quit or exit to quit the command-line utility.

Note:- mysql Command-Line Utility has many options to integrate the graphical UI tools to connect with it, but to be familiar with the command line will only help you.

Hope this will help you.



5 thoughts on “MySql Command Prompt-Tips and Tricks.”

  1. I enjoy reading the report, too. It?s easy to understand that a journey like this is the biggest event in ones lifes

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.