CakePHP project does not connect to another server database

#1

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 .

#2

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”

#3

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

#4

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