MySQL is the actual database system that uses the Structured Query Language to process data. MySQL is currently the most popular open source database and is frequently utilized with PHP to create dynamic websites. That said, MySQL also works well with Python, Ruby and Perl. This article will guide you on how to access the MySQL tool via command line.

Note that you can only access MySQL via Shell, or command line, via a VPS or Dedicated server account. This is not a feature that is available on shared accounts.

Accessing MySQL via command line

  1. Log into your server via ssh.
  2. Once in your shell, you will at the command line prompt. To log into the MySQL monitor, use the following syntax:
    mysql -u <db-username> -p

    The <db-username> tag will need to be replaced with the actual database username with which you want to sign into the monitor. If you do not know which user you want to use, you can find a list of users for your databases via your cPanel.

  3. Once you have your database user name, enter command line code similar to below and hit Enter. In our case, we are using a database user named inmoti5_dbuser1.
    root@vps9999 [~]# mysql -u inmoti5_dbuser1 -p
  4. Due to the -p switch with nothing following, you will be required to enter your password as below. Simply enter the password and click Enter.
    Enter password:
  5. After entering the correct password you will be met with the following greeting and MySQL prompt:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 19472
    Server version: 5.5.30-cll MySQL Community Server (GPL)

    Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql>
Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Like this Article?

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

0 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!