• Skip to main content
  • Skip to primary sidebar

DBA Diaries

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

How to List MySQL Databases Using SHOW DATABASES

June 14, 2014 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 fix "conversion failed when converting date and/or time from character string"
    How to fix "conversion failed when converting date…
  • sql grouping sets
    Using SQL GROUPING SETS for Multiple GROUP BY…

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+

Reader Interactions

Leave a Reply Cancel reply

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

Primary Sidebar

Categories

  • All Articles (84)
  • 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 (21)

Top 10 Popular Posts

  • Using sp_change_users_login to fix SQL Server orphaned users
  • MySQL SHOW USERS? – How to List All MySQL Users and Privileges
  • 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
  • T-SQL – How to Select Top N Rows for Each Group Using ROW_NUMBER()
  • New T-SQL features in SQL Server 2012 – OFFSET and FETCH
  • How to Kill All MySQL Processes For a Specific User
  • Using exec sp_who2 to help with SQL Server troubleshooting
  • How to fix “conversion failed when converting date and/or time from character string”

Recent Posts

  • How to fix “conversion failed when converting date and/or time from character string”
  • Using SQL GROUPING SETS for Multiple GROUP BY Queries in a Single Query
  • 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

Search

Connect

  • Twitter
  • Facebook
  • RSS

About

  • Cookie Policy
  • Disclaimer
  • About
Copyright ©