CakePHP project does not connect to another server database

I make a simple registration and log in website using CakePHP 3.6. It works fine in my local machine. Then I upload the project in another server and my database is another server. Now when I go to log in or register the project does not get database connection. I configure /app/config/my.cnf
‘Datasources’ => [
‘default’ => [

           'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Mysql',
            'persistent' => false,
            'host' => ' ', [ here I put database server ip address ]
            /*
             * CakePHP will use the default DB port based on the driver selected
             * MySQL on MAMP uses port 8889, MAMP users will want to uncomment
             * the following line and set the port accordingly
             */
            'port' => ' ', [here I put database server port]
            'username' => '', [here I put database server user name]
            'password' => '', [[here I put database server user name's password]
            'database' => ' ', [here I give my database name]

I give host my database ip but may be it not get.
here is the output of log in cakephp_database_error
I did all the changes but I don’t know why not get database server. Please if you know help me. I am really trying very hard to solve this .

Its a mysql privilege related problem, are your mysql server in a diferent server than the cakephp app?
Check the database privileges:
select Host, User, Password from user

seach for “mysql remote connection”

YES it was mysql privilege problem. I solved it. Now my CakePHP project is running fine. Thank you so much .

Hi,
I’m with the same trouble, was you using MAMP?

I was having issues with this on a LAMP remote server. Mysql was an existing setup on another server. In the username setup I can manage the IP address or domain it is allowed to have access from. I added the remote server IP address and was able to connect to the database.