Search code examples
phpmysqlphp-5.6mysql-5.6

Can't find MySQL table


Moving an existing PHP/MySQL website to a new Windows server.
The oddity is that it uses two database schemas on the same server.
Have imported the data for both. I can query tables from both schemas from MySQL Workbench.

But the website can only find one schema.

Uncaught exception 'Exception' with message 'MySQL query error: Table 'schema_two.tbl_any' doesn't exist on line 140'

Whatever code first requests data from the second schema fails.
If I change the table it is looking for, still can't find it.
But if I have it look for a table from the first schema, finds it with no problem.

As far as I know, the user should have access to both schemas, since this user imported both. On the other hand, I have three instances of 'root' under Users and can't view Schema Privileges for any of them.

Other than user permissions, I can't think of a scenario where it should find one schema and not the other.

Results of

SELECT User, Host, plugin FROM mysql.user;

 root   localhost   mysql_native_password
 root   127.0.0.1   mysql_native_password
 root   ::1 mysql_native_password
        localhost   mysql_native_password

If I can't come up with anything, I'll just move all those tables into the first schema. 8: -(

And yes, this is an old version of PHP. This is a migration project.


Solution

  • Start by logging in as that user and seeing what schemas are available.

    And yeah, if you don't get conflicts, moving into the same schema may be your best way out.