Question
-
CreatorTopic
-
May 18, 2020 at 3:36 pm #2143210
How to list databases from Linux command list?
Lockedby samueltarcin9999 · about 4 years, 6 months ago
Tags: Operating Systems
I have a mariadb database and I want to list existing databases from the linux command line.
Topic is locked -
CreatorTopic
All Answers
-
AuthorReplies
-
-
September 7, 2020 at 5:55 pm #2421957
DATABASE LINUX COMMAND
by jackdanielsking2 · about 4 years, 2 months ago
In reply to How to list databases from Linux command list?
When administering MySQL database servers, one of the most common tasks you’ll have to do is to get familiar with the environment. This involves tasks such as listing databases that reside on the server, displaying the tables of a particular database, or getting information about user accounts and their privileges.
This tutorial explains how to show all databases in a MySQL or MariaDB server through the command line.
The command will print a list of all the databases for which the user has some kind of a privilege granted to . The output will be similar to this:
Show MySQL Databases
The most common way to get a list of the MySQL databases is by using the MySQL client to connect to the MySQL server and run the SHOW DATABASES command.
Another command that you can use to list the databases is SHOW SCHEMAS which is a synonym for the SHOW DATABASES command
Show All MySQL Databases
To list all the databases on the MySQL server you’ll need to login as a user that can access all databases, by default that is the MySQL root user or set a global SHOW DATABASES privilege.Log in a MySQL root user:
The LIKE clause can be used to filter the output of the SHOW DATABASES command according to a specific pattern
For example, the following statement will return all databases which names starts with ‘open’:
If you want to make a more complex search you query the schemata table from the information_schema database which contains information about all databases.The following statement will give you a list of all databases that starts with either “open” or “word”
Show MySQL Databases from the Command Line
To get a list of the databases without logging in to the MySQL shell you can use either the mysql command with the -e option which stands for execute or the mysqlshow that displays databases and tables information.This is especially usefully when you want to work with your MySQL databases using shell scripts.
Run the following command on your terminal to show a list of all databases:
Access the MySQL server using the following command and enter your MySQL user password when prompted
Conclusion
You have learned how to get a list of all databases in your MySQL server.Feel free to leave a comment if you have any questions.
-
December 28, 2020 at 5:25 am #2418946
How to list databases from Linux command list?
by rvkanth1996 · about 3 years, 11 months ago
In reply to How to list databases from Linux command list?
The most common way to get a list of MySQL databases is to use the MySQL client to connect to the MySQL server and run the SHOW DATABASES command. If you have not set a password for the MySQL user, you can omit the -p option.
-
September 29, 2023 at 5:20 am #4169318
Reply To: How to list databases from Linux command list?
by spotiflyeronline · about 1 year, 2 months ago
In reply to How to list databases from Linux command list?
Run the following query to show list of databases: SHOW DATABASES; You can run this statement from MySQL Command Line Client, MySQL Shell, as well as from any GUI tool that supports SQL—for example, dbForge Studio for MySQL. MySQL returns the results in a table with one column—Database.
- This reply was modified 1 year, 2 months ago by kees_b.
-
-
AuthorReplies