Search code examples
mysqlphpmyadmin

MySQL database shows in phpMyAdmin but not the command line client


I have installed MAMP and set it up with wordpress. Everything is OK except that I have four databases under mysql through terminal. They are - information_schema,mysql,performance_schema, test

But when I enter phpmyadmin, it shows - information_schema,mysql,performance_schema, wordpress.

Under the actual wordpress db there are many tables, but under test there is no subfiles stored and it has no tables.

What could be the problem? Thanks!


Solution

  • So you see the database from within phpMyAdmin and want to know why you can't see it from the command line (terminal); this appears to be because you're not connected as the same user. Even if you're connected as the same user name, if one user is connected via sockets and the other through the TCP/IP connection it would explain the problem because MySQL treats different incoming hosts and connection types as different users.

    To check this, look at the main page of phpMyAdmin, on the right side where it shows "Server" and "User" listed under the Database server section. Then connect from the command line client and run the status; command, and compare the output.

    To fix it, either connect as the correct user (the -u and -h options may be helpful here), or grant the proper permissions to the user you're connecting as from the command line.

    Test is probably just a demo or test table and has no relation to your wordpress work or the problem seeing the wordpress database.