How can I find what databases I have a minimum of read access to in either basic SQL, MySQL specific or in PHP?
Asked
Active
Viewed 275 times
3 Answers
5
There is a command in MySQL which can show you all of the permissions you have. The command is:
SHOW GRANTS;
It will give you output similar to:
root@(none)~> show grants; +---------------------------------------------------------------------+ | Grants for root@localhost | +---------------------------------------------------------------------+ | GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION | +---------------------------------------------------------------------+ 1 row in set (0.00 sec)
This is documented at in the manual here.

Harrison Fisk
- 7,074
- 3
- 24
- 14
1
You could also try connecting to the database with phps mysql_connect(...) will tell you quickly whether or not you have access.

SeanJA
- 10,234
- 5
- 32
- 42
-
That would only show weather or not I can connect to the database server with the given username and password, it will not show weather or not the user has write permissions on a specific database. – UnkwnTech Mar 10 '09 at 22:38
1
In MySQL, you can execute
SHOW DATABASES;
Description
SHOW DATABASES;
to see what you have at least minimal access to. Are you looking for something more programmatic?

Jay Shepherd
- 1,958
- 1
- 12
- 6