Do you only have 1 db connection defined, or multiple?
save() use wrong DB_HOST but the correct DB_USER
Hello,
I have a weird bug and I can't find a solution to it, namely:
I host my website with the Forge Service, my database is on an external server, now to my problem.
I'm trying with a "post" function to change a value in the database to verify an email, the values it can read out problem without error, but as soon as I get a value like
$verify->email_verified = 1;
$verify->save();
as an example, he takes the IP address of the web server and tries to connect to it, only now the problem my database is on an external server. This also works and you can read or enter values (with create etc.), only with this save() and update(); value edits it wrong.
ERROR:
Illuminate/Database/QueryException with message 'SQLSTATE[42000]: Syntax error or access violation: 1142 UPDATE command denied to user 'database_user'@'WRONGSERVERIP' for table 'table_name' (SQL: update `table_name` set `email_verified` = 1, `updated_at` = 2018-10-11 21:28:06 where `id` = 2)'
I hope someone can help me.
That doesn't mean it's trying to connect to a different db at all!
You do know that you can grant permissions for users tied to specific IP's, right? That's all database_user'@'WRONGSERVERIP is meaning. It does NOT mean WRONGSERVERIP is the server it's trying to connect TO. That's the IP that the user is allowed to connect FROM.
Please please please check the permissions for the db user. What will it hurt? It takes like 20 seconds to do lol.
For instance, to create a user that is only allowed to access the db FROM server 1.2.3.4 and grant all privileges for all tables to db "db1", it would be
CREATE USER 'username'@'1.2.3.4' IDENTIFIED BY 'password';
GRANT ALL ON db1.* TO 'username'@'1.2.3.4';
I'm 95% sure that's what your issue is. The user doesn't have the correct permissions and/or ip. I don't think this has anything to do with any other server except your remote db server.
in the error log: "WRONGSERVERIP" was the ipv4 address from the production server
That actually sounds correct due to what I mentioned above. The user should have permissions to access from your production server. It's not trying to connect TO the production server.
Please or to participate in this conversation.