cruex

Experience

3,320

0 Best Reply Awards

  • Member Since 8 Months Ago
  • 32 Lessons Completed
  • 5 Favorites

11th October, 2018

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER • 4 days ago

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)'

UPDATE command denied to user 'database_user'@'WRONGSERVERIP'

in the error log: "WRONGSERVERIP" was the ipv4 address from the production server

and the external db server working perfect with no error

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER • 4 days ago

Yes, I am aware of that, but what is the point if I check the rights on the production server if he should not access it at all? The system is supposed to access the externally hosted database. And right now, he's trying to access the local database. But it's just this one function that confuses me.

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER • 4 days ago

There is no database service installed on the Production server.

This is the function in the controller

    public function verifyPost($token)
    {
        $verify = Subscriber::where('email_token', $token)->first();
        $generateToken = generateToken();

        $verify->email_verified = 1;
        $verify->email_token = $generateToken;
        $verify->save();

        return redirect( route('welcome'));
    }

any error or syntax error? (generateToken() is a helper function)

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER • 4 days ago

The database has enough rights, otherwise I couldn't have anything created. And the query doesn't help me, because he uses the wrong IP from the Database server. But thanks for your help and ideas.

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER • 4 days ago

The array from the thinker looks okay, IP is set and all another vars.

I have not defined a connection on a DB query builder or in an Eloquent model...

I'm a little confused. ^^'

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER • 4 days ago

.env

DB_CONNECTION="mysql"
DB_HOST="XX.XX.XX.XX"
DB_PORT="3306"
DB_DATABASE="db"
DB_USERNAME="usr"
DB_PASSWORD="XXXXXXXXXXXXXXX"

config/database.php

'connections' => [
    'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,
        ],
],

Reading and creating works in the database, only save() and update() makes the mistake so far.

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER • 4 days ago

Yes only 1 Database and the driver is MySQL

cruex started a new conversation Save() Use Wrong DB_HOST • 4 days ago

Hello. I have a strange mistake,

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 this save(); value edits it wrong.

I hope someone can help me.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.