Steps to View MariaDB databases in SSH

When managing databases in cPanel using MariaDB, the interfaces remain the same as those used for MySQL. MariaDB is designed to seamlessly replace MySQL. This tutorial demonstrates several commands via SSH to view databases with MariaDB. 

For those inclined towards the command line, this article guides you on listing or viewing databases through the MariaDB command line interface (CLI), a preferred method for many database admins. Alternatively, for a graphical interface, PhpMyAdmin is available.

How to List Databases in MariaDB

To begin, log in to your server via SSH. Subsequently, use the same command to access MariaDB as you would with MySQL:

mysql -u -p

You will be prompted for a password. Note: Ensure to replace with your actual cPanel username or, if on VPS, the root user is also available to you.

At this point, your regular command prompt will transition to the MariaDB prompt:

SSH login

To accurately list your databases or display databases, you just need to execute the following command:


Show databases command

Using MariaDB for Database Operations

If you have a particular database in mind that you wish to work on, you'll need to instruct MariaDB about the specific database you want to engage with:

USE <databasename>;

Certainly, replace with the actual name of the database you intend to use. If executed correctly, you'll receive a notification confirming the database change, and the MariaDB prompt will display the database name within brackets:

Database changed

MariaDB [<databasename>]>

How to Display Tables in a MariaDB Database

To observe the tables within a chosen database, employ the "SHOW" command as illustrated below:

SHOW tables;

show tables command

How to Display All Records in a MariaDB Table

Having directed MariaDB to reveal all databases, selected a specific database, and viewed tables, the next step is to exhibit all the records stored in a particular table. This can be achieved using a "SELECT" statement:

SELECT * FROM <databasetablename>

Ensure to replace with the actual name of the table. This command will display all records.

Note: To view specific database details, it is essential to have selected a database using the USE command (refer to the instructions above). Subsequently, you can employ the "DESCRIBE" command to obtain additional information about this table:

DESCRIBE <databasetablename>;

Congratulations! You now possess the knowledge to inspect databases and tables in MariaDB directly from the command line interface.

Was this article helpful?

mood_bad Dislike 0
mood Like 1
visibility Views: 1773