MySQL – How to Connect to MySQL Server on Command Prompt

I have so far authored 5 courses on MySQL at Pluralsight, and one of the most popular question, I keep on getting is how to connect to MySQL with Command Prompt. You may find it funny enough that people who are learning MySQL would know how to connect to command prompt, but trust me, we all start from somewhere and we do not have to be an expert at everything. I respect every single question and I would like to answer this very question over here.

Step 1: Go to the folder where the MySQL exe file is located

For example, in my machine the location of the MySQL execution file is at “C:\Program Files\MySQL\MySQL Server 5.6\bin”. I changed the context of the command prompt to the folder where the MySQL exe file is located.

Step 2: Enter following commands in the command prompt

mysql -h nameofthehost -u username -p

In the above command, replace nameofthehost with actual host name and username with actual username.  Now click on enter.

When clicked enter, it will ask for the password. Enter the password and click on enter.

It will connect you with MySQL Server.

Well – that’s it! You are connected to MySQL Server. Once you connect to MySQL Server, do not forget to continue watching MySQL Basics and Performance Tuning courses.

Reference: Pinal Dave (http://blog.sqlauthority.com)

About these ads

2 thoughts on “MySQL – How to Connect to MySQL Server on Command Prompt

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s