简体   繁体   中英

Number of tables in the database in phpmyadmin 4

It seems as if the Count Tables configuration option doesn't work anymore in phpmyadmin 4.

$cfg['Servers'][$i]['CountTables']=true;

How to show the number of tables in the database in phpmyadmin 4 ? I have many databases and I need to know the number of tables inside a database, for example which database is empty or not.

Run this query to get the number of tables in each database:

SELECT
      table_schema AS database_name
    , COUNT(*) AS table_count
FROM
    information_schema.tables
GROUP BY
    table_schema

I'm assuming that it's on a development server so access to the information_scheme database shouldn't be a problem. Just keep in mind that the "information_schema", "sys" and "mysql" databases are internal to MySQL and/or PHPMyAdmin so NEVER make any changes to them databases!

To get a count of tables by database, including empty databases, try

SELECT s.schema_name, COUNT(t.table_name) 
FROM information_schema.schemata s 
LEFT JOIN information_schema.tables t 
ON (s.schema_name = t.table_schema and t.table_type = 'BASE TABLE') 
GROUP BY s.schema_name 
ORDER BY s.schema_name;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM