How to List a Databases in MariaDB on Ubuntu 22.04


In the last guide, we discussed the method for creating a table in MariaDB on Ubuntu 22.04. So, today, we are about to learn the procedure for listing databases in MariaDB.

Listing databases in MariaDB on Ubuntu means displaying a list of all the databases present in the MariaDB instance. We list databases to verify successful creation, manage databases and troubleshoot issues.

In this post, we elaborated on the method of listing databases in MariaDB on Ubuntu 22.04.

Listing Databases in MariaDB on Ubuntu 22.04

Listing databases in MariaDB on Ubuntu involves displaying a list of all the databases created in the MariaDB instance. The main purpose of listing databases in MariaDB is to verify that a database has been successfully created, manage databases by performing tasks such as creating tables and modifying data, and troubleshoot issues if a database is not functioning correctly.

This section offers instructions for listing databases in MariaDB on Ubuntu 22.04.

Step 1: Open the terminal

Press “CTRL+ALT+T” to launch the terminal:

Step 2: Open MariaDB Shell

Run the mentioned command in the terminal to open the MariaDB shell:

mysql -u root -p

Step 3: List Databases

For listing databases, write the mentioned command in the MariaDB shell:

SHOW DATABASES;

Step 4: Select Database (optional)

After listing all databases, you can choose a specific database. For this, execute the command below in the MariaDB shell:

USE linuxgenie;


That was all about listing databases in MariaDB on Ubuntu 22.04.

Conclusion

For listing databases in MariaDB on Ubuntu 22.04, launch the Ubuntu terminal. Then, use the “mysql -u root -p” command to open the MariaDB shell. For listing databases, utilize the “SHOW DATABASES;” command. Once all of the databases are listed, you can select one of these databases using the “USE linuxgenie;” command. That’s how you can list databases in MariaDB on Ubuntu 22.04.

Print Friendly, PDF & Email
Categories