skip to Main Content

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

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search