简体   繁体   中英

mysql information_schema empty and not populating

Running WAMP localhost server With php 5.6.18 and MySQL 5.7.11

In project that im working on now i need to get some column data form information_schema . COLUMNS table, but information_schema DB is completely empty - 0 rows for every table in this DB

For additional information - I have like 10 differnet DB on this MySQL, some are imported some are made from scratch in phpmyadmin.
So im completely lost - tried to google but no luck.

Maybe i miss something essential and trivial like some configuration of MySQL?

Execute this query:

mysql> SHOW GRANTS;

This will show you that either you are not logging in as the user you intend to use, or that this user lacks permissions on the tables in question.

In this case, the user may have no permissions at all. MySQL has a special permission called USAGE , which may seem slightly deceptively named if you aren't familiar with what it means. It means you can "use" the server -- that is, you can log in. But that is all it means. If you possess only the USAGE ON *.* privilege, this means you have permission to log in to the server, but no permissions on anything else.

The information_schema is integrated with the permissions system. You can't see information about database objects for which you don't have permissions. An empty information_schema.columns table suggests a permissions issue for the user you are using to connect to the server.

Sometimes this may be issue when you copy and paste the database's folders in mysql folder. Don't copy that way. The best way to export the databases using "export" command in "phpmyadmin" or use "mysqldump" command in mysql command line client to copy the data or export data from one to another.It will generate "yourdata.sql" file at the last , You can import that data using "export command in "phpmyadmin" . In your method is successful for "MyISAM" database driver in mysql. Modern mysql servers default database driver is "InnoDB" and it not success in when copy the database data folder on to another machine. If you have copy of previous copy of the databases from the old machine, try to export the "yourdata.sql" file using export method in "phpmyadmin" web interface.

I faced same problem when I transfer/shifted my mysql folder to other location. And configured DB to point Mysql folder accordingly.

However, Information_schema was not getting updated though rest DB queries were running fine.I could't find proper solution but the way around was from mysql editor (like workbench) do inspect schema.

You will get an option in bottom to 'Information Outdated' and then click on Analyze table. You will find that Information_schema start calculating correct size and other details.

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