5

I exported our production database and created a development database called test. Using ssh I imported the tables/data into the development database.

mysql -u root -p -h localhost test < data.sql

I can view the database structure and it returns rows as expected when I use the command line mysql. However, when I open up phpmyadmin, the "test" database is there but it has no tables and I can't select any of the data.

Any idea on how to fix this?

2
  • I had the same issue. The reason was in changed write permissions on /tmp directory. Where I ran Describe TABLENAME command in phpmyadmin SQL tab it failed with error message that it was unable to write into /tmp directory. So I have changed permissions on /tmp through chmod and the issue disappeared.
    – zavg
    Nov 15, 2013 at 14:44
  • I know, this question is over 10 years old but I faced the same issue and found another cause. Prior to importing my databases I added the default tables like information_schema etc. to the "hide databases" setting. I have no clue why but simply clearing that field made all databases appear. I was able to hide the default databases once the development databases showed up. Dec 16, 2021 at 20:08

4 Answers 4

16

I had a similar problem with one database and I'd like to share with you a possible cause/solution:

I have imported a .sql file as you did and then I went to phpmyadmin, selected the database and surprise: No tables in the database, but I went to mysql command line and did a SHOW TABLES and they do exist.

So this is what happened in my case, the original database had some VIEWS defined by a user that did not exist in my computer's mysql users. Example:

CREATE ALGORITHM=UNDEFINED DEFINER=admin@% SQL SECURITY DEFINER VIEW cantidades AS select (...)

The user admin@% was available on the original server from where I've exported the database, but not on my computer.

So the fix to this solution was either to add that user, or to drop the views and create them again with a existing user.

I have choosen the second option: DROP VIEW cantidades; CREATE ALGORITHM=UNDEFINED DEFINER=root@localhost SQL SECURITY DEFINER VIEW cantidades AS select (...)

I've used root because that is the default user for my local XAMPP installation, but for security purposes I recommend using the same user you use to connect to that database.

2
  • This worked after pulling my hair out for the past few hours! I installed mysql workbench and I was able to drr all the tables and views in the database I had just imported, but not in phpmyadmin. I navigated to the views section in mysql workbench and just dropped all the views and viola I was able to see the tables in phpmyadmin again.
    – dannyp
    Oct 15, 2012 at 22:14
  • 1
    This was the same problem I had. A quick clue if it applies to you also. Do a quick SQL query SHOW TABLE STATUS; If you get an error saying you don't have user permissions to select, you'll need to alter the view.
    – Pooch
    Mar 29, 2013 at 6:25
3
  1. Check admin database user name for the database you selected to import
  2. Create a user with same name in the newly imported database through phpmyadmin.

Your problem will be fixed.

0

Sounds like the database user you are using to connect via phpmyadmin doesn't have permissions on the test database.

1
  • I created the databases with root and I'm logging into phpmyadmin as root.
    – AllisonC
    Apr 6, 2011 at 11:59
-6

I don't know how but this has been fixed by my coworker. Thanks anyway. Turns out he changed where the database was...

Not the answer you're looking for? Browse other questions tagged or ask your own question.