-1

I've been searching around the internet trying to find an answer to this with zero success.

Basically I have several databases that hold several tables, which I would like to create a table for.

I imagine a view would probably be better for this, but regardless, I would like to create a php script that calls said view/table that lists all my databases(I know there is a show all databases command, but I don't think I can display that outside of phpmyadmin),

I'd also like it be able to update itself as new databases are added to the server, which is why I thought that a view might be necessary. I'm not sure if this is even possible which is what led me here. Any light on this matter would be greatly appreciated!

Thanks

Strawberry
  • 33,750
  • 13
  • 40
  • 57

2 Answers2

0

I would use the show databases command, not a table. Basically you're using the table of MySQL itself with that command. It will also automatically update! Here's the PDO variant.

KIKO Software
  • 15,283
  • 3
  • 18
  • 33
0

I would use this:

SELECT * FROM INFORMATION_SCHEMA.SCHEMATA

Read more: https://dev.mysql.com/doc/refman/8.0/en/information-schema-schemata-table.html

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828