- These instructions are intended for viewing the selected MySQL database via the command line.
- I’ll be working from a sxi.io Web Core Managed CentOS 7 server, and I’ll be logged in as root.
Login to MySQL
First we’ll login to the MySQL server from the command line with the following command:
mysql -u root -p
In this case, I’ve specified the user root with the -u flag, and then used the -p flag so MySQL prompts for a password. Enter your current root password to complete the login.
You should now be at a MySQL prompt that looks very similar to:
View Selected Database in MySQL
By default all MySQL operations run via the MySQL command line are performed on the currently selected database; thus, it’s important to know which database is currently selected. To find out issue the following command:
Your result may be similar to this:
mysql> SELECT database();
| database() |
| NULL |
1 row in set (0.00 sec)