DBA Diaries

Thoughts and experiences of a DBA working with SQL Server and MySQL

Home All Articles How to List MySQL Databases Using SHOW DATABASES

How to List MySQL Databases Using SHOW DATABASES

Posted on June 14, 2014 Written by Andy Hayes Leave a Comment

Want a list of MySQL databases? In this quick guide, I demonstrate how to show a list of databases in MySQL using SHOW DATABASES.

First, login as user root to your MySQL instance.

mysql -uroot -pYourPassword

Now that you are logged in, you simply need to run the SHOW DATABASES command.

SHOW DATABASES;

Produces the following list.

+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+

As I am logged in as root, I can see all databases. If you run this as another user, you will only see the databases that the user has access to.

You can also look for specific databases which is useful if your server contains many databases.

SHOW DATABASES LIKE 'mysql';
+------------------+
| Database (mysql) |
+------------------+
| mysql            |
+------------------+
1 row in set (0.00 sec)

Or you can use a wildcard to look for databases containing specific text.

SHOW DATABASES LIKE 'my{3a76cbff1b5ce5ace3bd34bbdd68f71285d81fb9af60114c7a6db80d3a8688de}';
+----------------+
| Database (my{3a76cbff1b5ce5ace3bd34bbdd68f71285d81fb9af60114c7a6db80d3a8688de}) |
+----------------+
| mysql          |
+----------------+
1 row in set (0.00 sec)

How to Show MySQL databases in MySQL Workbench

There are two ways, those listed above as seen here

mysql show databases

And you can also browse a list of available MySQL schemas but this does not include databases such as mysql or performance_schema

mysql list schemas

Related Posts:

  • How to set up MySQL Replication TutorialHow to set up MySQL Replication Tutorial
  • How to Setup MySQL Master Master ReplicationHow to Setup MySQL Master Master Replication
  • How to Take a Backup of a Table in MySQLHow to Take a Backup of a Table in MySQL
Share this...
Share on Facebook
Facebook
Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
Pin on Pinterest
Pinterest
Share on Reddit
Reddit
Share on StumbleUpon
StumbleUpon
Share on Tumblr
Tumblr
Buffer this page
Buffer

Filed Under: All Articles, MySQL Administration Tagged With: mysql

About Andy Hayes

Andy Hayes is a DBA working with SQL Server since version 7.0. He has a wonderful wife and two beautiful children. He loves database technology, playing cricket, and blogging. He is passionate about sharing his experiences as a DBA and learning more to further his understanding and knowledge. You can follow me on Twitter, check out my Facebook page or follow me on Google+

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

CAPTCHA
Refresh

*

Categories

  • All Articles (82)
  • Career Development (8)
  • MySQL Administration (18)
  • MySQL Performance (2)
  • SQL Server Administration (24)
  • SQL Server News (3)
  • SQL Server Performance (14)
  • SQL Server Security (3)
  • SQL Tips and Tricks (19)

Top 10 Popular Posts

  • Using sp_change_users_login to fix SQL Server orphaned users
  • How to shrink tempdb
  • How to Transfer Logins to Another SQL Server or Instance
  • How to Delete Millions of Rows using T-SQL with Reduced Impact
  • MySQL SHOW USERS? – How to List All MySQL Users and Privileges
  • New T-SQL features in SQL Server 2012 – OFFSET and FETCH
  • T-SQL – How to Select Top N Rows for Each Group Using ROW_NUMBER()
  • How to move tempdb
  • How to Kill All MySQL Processes For a Specific User
  • Using exec sp_who2 to help with SQL Server troubleshooting

Recent Posts

  • How to Setup MySQL Master Master Replication
  • How To Use SQL to Convert a STRING to an INT
  • How to set up MySQL Replication Tutorial
  • How to Use SQL CASE for Conditional Logic in Your SQL Queries
  • Using ISNULL in SQL Server to Replace NULL Values

Search

Connect

  • Twitter
  • Facebook
  • Google+
  • RSS

About

  • Cookie Policy
  • Disclaimer
  • About
Copyright © ‘2019’ DBA Diaries built on the Genesis Framework

This site uses cookies. We assume you are happy with cookies but click the link if you are not. Close