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
You will be prompted for a password. Note: Ensure to replace
At this point, your regular command prompt will transition to the MariaDB prompt:
To accurately list your databases or display databases, you just need to execute the following command:
SHOW DATABASES;
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
Certainly, replace
Database changed
MariaDB [
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;
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
Ensure to replace
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
Congratulations! You now possess the knowledge to inspect databases and tables in MariaDB directly from the command line interface.