Question

PHP migration with managed MySQL

Hello,

When I try to run migrations on App Platform during deploy, php artisan migrate --force, I get the following error even though I granted for db_user: SELECT, GRANT OPTIONS on information_schema, and GRANT ALL on my_schema_name.

Error:

In Connection.php line 712: SQLSTATE[HY000] [1045] Access denied for user ‘db_user’@‘IP_ADDRESS’ (using password: YES) (SQL: select * from information_schema.tables where table_schema = my_schema_name and table_name = migrations and table_type = ‘BASE TABLE’)

In Connector.php line 70:
SQLSTATE[HY000] [1045] Access denied for user ‘db_user’@‘IP_ADDRESS’ (using password: YES)

Do you have any idea how to resolve this problem?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

In addition to what has already been mentioned, keep in mind that MySQL sets privileges based on account names, which consist of a user name and a hostname in the format 'user_name'@'host_name'. You can specify the host by name with wildcard characters (like %, as in 'user_name'@'%', which matches all hosts).

That way the MySQL user that you are using would be able to connect from the App platform to the managed MySQL cluster.

For more information about the user privileges, check out the documentation here:

https://docs.digitalocean.com/products/databases/mysql/how-to/modify-user-privileges/#privilege-restrictions-on-digitaloceans-mysql-managed-databases

Best,

Bobby

Hu @NikolaMilic,

From the error, you are receiving I see two possible issues, either the user you are trying to connect does not have the proper permissions OR your password is not correct.

Additionally, check the following Docs for your app-platform and how to add managed databases to it:

https://docs.digitalocean.com/products/app-platform/how-to/manage-databases/