Connect proxysql credential

hi . i have problem with connect to database for first time (register) and i got error:

the credential that i entered is proxysql that i can work with it in terminal like for example:

mysql -h 192.168.1.139 -P 6033 -u nextcloud -p'abcd' -e "USE nextcloud; create table users(name varchar(255))";

{“reqId”:“vyrxnXgVYFnoYBlzuTds”,“level”:3,“time”:“2023-11-23T21:27:40+00:00”,“remoteAddr”:“127.0.0.1”,“user”:“–”,“app”:“no app in context”,“method”:“POST”,“url”:“/index.php”,“message”:“Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] ProxySQL Error: Access denied for user ‘oc_admin13’@‘192.168.1.131’ (using password: YES)”,“userAgent”:“Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36”,“version”:“24.0.0.12”,“exception”:{“Exception”:“Doctrine\DBAL\Exception”,“Message”:“Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] ProxySQL Error: Access denied for user ‘oc_admin13’@‘192.168.1.131’ (using password: YES)”,“Code”:1045,“Trace”:[{“file”:“/var/www/html/nc_stage/lib/private/Setup/MySQL.php”,“line”:64,“function”:“connect”,“class”:“OC\DB\Connection”,“type”:“->”},{“file”:“/var/www/html/nc_stage/lib/private/Setup.php”,“line”:353,“function”:“setupDatabase”,“class”:“OC\Setup\MySQL”,“type”:“->”},{“file”:“/var/www/html/nc_stage/core/Controller/SetupController.php”,“line”:74,“function”:“install”,“class”:“OC\Setup”,“type”:“->”,“args”:[“*** sensitive parameters replaced “]},{“file”:”/var/www/html/nc_stage/lib/base.php",“line”:956,“function”:“run”,“class”:“OC\Core\Controller\SetupController”,“type”:“->”,“args”:[" sensitive parameters replaced ***”]},{“file”:“/var/www/html/nc_stage/index.php”,“line”:36,“function”:“handleRequest”,“class”:“OC”,“type”:“::”}],“File”:“/var/www/html/nc_stage/lib/private/DB/Connection.php”,“Line”:139,“CustomMessage”:“Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] ProxySQL Error: Access denied for user ‘oc_admin13’@‘192.168.1.131’ (using password: YES)”}}

what is the problem? and how to fix?

and

You connect to your proxysql with the username nextcloud and the password abcd.

The proxysql (residing on the host 192.168.1.131) tries to connect to the (real) database as user oc_admin13

The error message you’re getting indicates that the user ‘oc_admin13’ is not allowed to connect to the database from the IP address ‘192.168.1.131’. This can happen due to a number of reasons:

  1. Wrong username/password combination: Double-check your username and password.
  2. User not granted access: The user ‘oc_admin13’ might not have been granted access to the database.
  3. IP address not allowed: MySQL allows specifying allowed host/IP for each user. If ‘192.168.1.131’ is not in the list of the allowed hosts for ‘oc_admin13’, you would get this error.

You can grant access to the user (point 2.) and add the IP address to the allowed hosts (point 3.) using a command like:

GRANT ALL PRIVILEGES ON nextcloud.* TO 'oc_admin13'@'192.168.1.131' IDENTIFIED BY 'password';

I assumed that ‘nextcloud’ is your database. Replace ‘password’ with your actual database password for the user ‘oc_admin13’@‘192.168.1.131’.
After running these commands, ensure you flush privileges using:

FLUSH PRIVILEGES;

If you continue to face the issue even after trying these steps, you might want to check ProxySQL settings. Ensure that ProxySQL is correctly configured to forward connections to your actual MySQL server and that it has the correct credentials.

Much luck,
ernolf

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.