skip to Main Content

Here’s the scenario:

I created a MySQL database on CPanel using CPanel’s helper tool, also created a user for this database, and i run queries on this database using phpMyAdmin (which i also access through CPanel).

I’m developing a Laravel application using the PhpStorm IDE, and i need to connect the application to this remote database. My doubt is, which credentials should i put on .env file?

On the main page of phpMyAdmin, it says:

 Server: Localhost via UNIX socket
 Server Type: MySQL
 Server Connection: SSL is not being used

plus, the ‘host:port’ shows up as localhost:3306.

I already tried to use the ‘host:port’ credentials of my CPanel account, the localhost:3306, the user/password of my CPanel account, and the user/password created for the database (and all the combinations between these four credentials, plus using the database name) and nothing worked. I’m testing the connection on the PhpStorm’s ‘Add Database’ section, here. If it connects, I’ll know which are the right credentials. So far, i’ve only got "Access denied" error (example).

Am I looking at the right things? Or the only way to connect is using this SSL connection? (and if so, is there a tutorial on how to do this?)

Other suggestions on how to work on this scenario are welcome too 🙂

2

Answers


  1. Chosen as BEST ANSWER

    Just found the answer. The connection worked using the CPanel credentials (mycpanelhost.com:3306, CPanel login, CPanel password, DB name). Thing is, I didn't notice a section on CPanel called 'Remote MySQL', where I should put my IP address to allow the connection to the remote database.

    Lack of attention from my part :p. Anyway, much thanks for everyone who spend some time answering!


  2. If you are developing locally, you don’t want to connect to a remote database. Just set up a local DB to develop with.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search