Access MySQL Server From The Shell Prompt (Command Line)

MySQL software includes mysql client. It is a text-based client for mysqld, a SQL-based relational database server. It works interactive and non-interactive mode

Log into your server via ssh.
 Once in your shell, you will at the command line prompt.
 To log into the MySQL monitor,
 Use the following syntax:
root@xx:/#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.

Note: If you do not know which user you want to use, you can find a list of users for your databases via your cPanel.

Once you have your database username, enter command line code similar to below and hit Enter. In our case, we are using a database username inmoti5_dbuser1.

root@xx [~]# mysql -u inmoti5_dbuser1 -p
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:
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 4
Server version: 5.6.30-0ubuntu0.15.10.1 (Ubuntu)
mysql>

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s