How to connect to MySQL from command prompt?

In this video tutorial I will show you how you can connect to MySQL database from command prompt in windows.


 
Ads

How to connect to MySQL from command prompt?

This video tutorial walks you through the steps to connect to MySQL from command prompt in Windows machine. But the same concept is applicable to other platforms.

MySQL command line tool is very important tool for connecting to the MySQL database. Command line tool is installed with the MySQL server installation and it can be accessed by going to the command prompt and typing the “mysql <with arguments>”.

If you are not able to find the command as show below:

C:\Users\comp15>mysqll
'mysql' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\comp15>

Here is the video tutorial of: "How to connect to MySQL from command prompt?"

Then is sure that MySQL bin directory is not in the system path variable, to resolve this issue add the complete path of bin directory of MySQL database in system path variable.
 
After this close the command prompt and open it again so that it takes the new path variable. Now you should be able to access the mysql command from the command prompt.

To connect to MySQL database from command prompt use the following command:

mysql -uroot -proot

Here -u is used for supplying the username annd -p is used to provide the MySQL database password. In my case both username and password is root.

After this you will able to connect to MySQL database from command prompt. Check the following video tutorial:

You can use the following command to display the names of all database:

mysql> show databases;

Above command will list down all the databases.

To connect to a database you can use the following command:

mysql> connect mysql;

Please not that MySQL sql ends with the ; character.

In this video you learned How to connect to MySQL database from command prompt. Check all the tutorials of MySQL at http://www.roseindia.net/mysql/

 

Advertisements

Share on Google+Share on Google+

How to connect to MySQL from command prompt?

Posted on: November 23, 2015 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: How to connect to MySQL from command prompt?  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads