Nate
Nate

Reputation: 28414

PDO queries working on localhost but not on webserver -- how to debug the issue?

I have some pages that make PDO queries using prepare() and execute() (binding some parameters) and they work fine on localhost, but are failing online with messages like this:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1142 INSERT command denied to user ...

How do I debug this? I have no idea what is wrong, as it works on my development server (localhost), and I am new to PDO and don't know what to do.

I should also note that at least some of the PDO queries are working.

Thanks.

Upvotes: 1

Views: 1148

Answers (2)

Sello Lekgothoane
Sello Lekgothoane

Reputation: 86

It might be that you have limited permission on that mysql server, try run the query in phpMyAdmin and see if you get the same error.

Upvotes: 1

jeroen
jeroen

Reputation: 91742

The error message is pretty clear, the user you are using on your webserver does not have permission to insert a record. You need to set the correct permissions using the mysql command line or something like phpMyAdmin if you have it installed on the web-server.

Upvotes: 1

Related Questions