Oracle/MSSQL/MySQL

How to access MySQL Server from command Prompt

MySQL software includes mysql client. It is a text-based client for mysqld, a SQL-based relational database server. It works in an interactive and non-interactive mode. Here are some nice guides on this topic: How to debug a PowerShell script, how to install and debug logs with the CMTrace Tool, how to perform PowerShell syntax check using PSScriptAnalyzer, and Microsoft Bitlocker Administration and Management: Effect of renaming an MBAM or BitLocker protected Computer“.

Log into your server via ssh. Once you are in the shell, to log into the MySQL monitor, use the following syntax:

root@xxxxxx:/#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 the command line code similar to below and hit Enter. In our case, we are using a database username inm_dbuser1.

root@xxxxxx [~]# mysql -inm_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)
Copyright (c) 2000, 2016, 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.

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x