MySQL - SQLSTATE[HY000] [2002] Permission denied (v2023)

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Yves63
User
Posts: 39

MySQL - SQLSTATE[HY000] [2002] Permission denied (v2023)

Post by Yves63 »

Hi
I created a new project, holidays.
I created a database and I am able to synchronize all tables in the database on the server with phpMaker. Thererfore user and password are correct. I dont have any security options by now. When I open the URL, I receive this error:
/home/myweb/www/mywebsite.com/holidays/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php(101): An exception occurred in the driver: SQLSTATE[HY000] [2002] Permission denied .
I can see all the tables on the left side, but cannot access them. I do not understand this behaviour.
phpMaker v2023.11


arbei
User
Posts: 9384

Post by arbei »

Double check the definer/creator of the tables/views in your database, make sure the user you entered in the project has permissions to access them.


Yves63
User
Posts: 39

Post by Yves63 »

That's what I did.
phpMaker in register Database:
Username and Password are inserted and phpMaker can access the database, all tables are shown.
On the server the tables are created with the same user and password.
Register Security is empty
I generate all files.
In the webbrowser I receive this error.
Is the statement correct, that the tables should be acessed, when phpMaker can access the database (tables) in the register database ?


arbei
User
Posts: 9384

Post by arbei »

The error (SQLSTATE[HY000] [2002]) is from the database, it is not related to project settings. You need to check if the database username and password you entered in the project, make sure the user has permission to access the tables in the database. If you use Database_Connection server event (or advanced settings) that may change the database to be connected or database user, double check the user's permissions. Open the config.develoment.php and config.production.php under the "src" folder by text editor and check if the connection info is correct. If your database is remote, make sure your database allows remote connection.


Yves63
User
Posts: 39

Post by Yves63 »

Your answer made me realize, that I have to configure the Database_Connecting in the code. The server adress is not the same as the external adress.
Just to ask, in the phpMaker configuration (Project --> New) I have to insert the server. Could it be an idea to split this up in "Server Internal" and "Server External" instead of configuring Database_Connection ?
Anyway, thank you for your help.


arbei
User
Posts: 9384

Post by arbei »

You may read the example of Database_Connecting server event.


Post Reply