Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8385529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:41:36+00:00 2026-06-09T17:41:36+00:00

show databases shows all databases where you (logged in user) have some privileges. Is

  • 0

“show databases” shows all databases where you (logged in user) have some privileges.

Is there a way to show all databases where user “xxx” has some privileges?

Edit:
I have an user “mickey”:

mysql> show grants for mickey;
+-------------------------------------------------------------------------------------------------------+
| Grants for mickey@%                                                                                   |
+-------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'mickey'@'%' IDENTIFIED BY PASSWORD '*B9E506CBC9D7D8352A3C02DBC94677A5DEF491B8' |
| GRANT ALL PRIVILEGES ON `mickey\_%`.* TO 'mickey'@'%'                                                 |
+-------------------------------------------------------------------------------------------------------+

User mickey is allowed to create/drop databases and tables with name “mickey_%”. Filtering out these databases is easy but only because his databases have prefix “mickey_”.

there is one databases called “mickey_example2” where mickey has all privileges. I am not able to find this database in information_schema or mysql db.

And this ist the only information about ‘mickey’ in information_schema.USER_PRIVILEGES:

mysql> SELECT * FROM information_schema.USER_PRIVILEGES WHERE GRANTEE LIKE '%mickey%';
+--------------+---------------+----------------+--------------+
| GRANTEE      | TABLE_CATALOG | PRIVILEGE_TYPE | IS_GRANTABLE |
+--------------+---------------+----------------+--------------+
| 'mickey'@'%' | def           | USAGE          | NO           |
+--------------+---------------+----------------+--------------+

MySql manual says:

MySQL implements databases as directories in the data directory, so
this statement simply lists directories in that location. However, the
output may include names of directories that do not correspond to
actual databases.

which means to me that there does not have to be any information (about existing databases) avaiable in information_schema, especially if the database is empty.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:41:38+00:00Added an answer on June 9, 2026 at 5:41 pm

    After a lot of searching and reading I found out that there is no nice and clean way to find “show databases” for other users.

    I have changed my db design by doing following:
    – every database name begins with $username_
    – $username cannot contain underline “_”

    and I have a user without any grants except “SHOW DATABASES” and I found user’s databases using WHERE LIKE with SHOW DATABASES command:

    SHOW DATABASES WHERE `Database` LIKE ?
    

    and ? is replaced with:

    '$username\_%'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Running show grants; indicates that I am logged in as a user with all
I have a mysql datebase, and im trying to show in the results all
I have two .php files which show all contacts in a database, then allows
I may have gone crazy... but I am hoping there is a way to
so i have a little tricky combination here Company has many Users User belongs
I have list page to show all images with its name from database in
I have a mysql query that shows the users last viewed documents. Some sort
I want to show all users present in a database. I want to place
I've a table in a database where I need to show all the rows's
I am trying to update the database to show that something has been uploaded.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.