How do I connect my application to MySQL? (database host) Print

  • 0

In almost all cases the database host is localhost because your site and MySQL run on the same server. Set your application's config like this:

  • Host: localhost
  • Database name: your full cPanel name, e.g. cpuser_dbname
  • Username: e.g. cpuser_dbuser
  • Password: the password you set when creating the user
  • Port: 3306 (default)

You create these in cPanel under MySQL Databases. Connecting from an outside server or your home PC instead requires Remote MySQL and the server hostname. If localhost does not work, open a ticket for the correct host.


Was this answer helpful?

« Back