When you are working with MariaDB to manage databases in cPanel, you will be working with the same interfaces as you did when working with MySQL. MariaDB is made to be a drop-in replacement for MySQL. In this tutorial, we will be showing a few commands using SSH to view databases with MariaDB.
- How To List Databases in MariaDB
- How To Use MariaDB To Work On a Database
- How to View Tables in a MariaDB Database
- How to Show All The Records in a Table in MariaDB
For those who prefer to work on the command line, this article will instruct you on how to list databases or view databases with MariaDB via the command line interface (or, CLI). For many database admins, this is the preferred way to access MariaDB databases. For a graphical interface, you can use PhpMyAdmin.
How To List Databases in MariaDB
First, log into your server via SSH. Then, you will use the same command to log into MariaDB as you would with MySQL:
mysql -u <username> -p
You will be prompted for a password. Note: be sure to replace
<username> with your actual cPanel username or, if on VPS, the
root user is also available to you.
You will now see your normal command prompt has turned into the
To properly list your databases, or show databases, you will just need to run the command:
How To Use MariaDB To Work On a Database
You likely have a specific database in mind that you want to work with, in which case you will need to tell MariaDB which database you want to work on:
Of course, replace
<databasename> with the actual name of the database you want to use. If done correctly, you will see a notice that you have changed your database, and the MariaDB prompt will now print the name of the database in brackets:
Database changed MariaDB [<databasename>]>
How to View Tables in a MariaDB Database
To view the tables of a selected database, you can use the “show” command as follows:
How to Show All The Records in a Table in MariaDB
At this point, you have instructed MariaDB to show all databases, selected a database, viewed tables, and now it’s time to show all of the records recorded in a certain table, which you can do with a “select” statement:
SELECT * FROM <databasetablename>
And be sure to replace
<databasetablename> with the name of the table. This command will show all records.
Note: that in order to view database specifics, you will need to have selected a database with the USE command (see above). Then you can use the “describe” command to get more data about this table:
Well done! You know how to view databases and tables in MariaDB right from the command line interface.
For developers or sysadmins experienced with the command line, get high availability and root access for your application, service, and websites with Cloud VPS Hosting.