How can I find what databases I have a minimum of read access to in either basic SQL, MySQL specific or in PHP?
+1
A:
In MySQL, you can execute SHOW DATABASES; and SHOW TABLES; to see what you have at least minimal access to. Are you looking for something more programmatic?
Jay Shepherd
2008-09-15 15:19:22
+4
A:
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
2008-10-01 13:22:51
+1
A:
You could also try connecting to the database with phps mysql_connect(...) will tell you quickly whether or not you have access.
SeanJA
2009-03-10 02:03:11
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
2009-03-10 22:38:42