mySQL database hostname and creation

The hostname is simply localhost for accessing a database on the server using your website.

In a php configuration file it may look something like:

$dbhost = "localhost";

The database name and the username are going to be prepended by your cPanel username.  So, if you create a database called books and a username called george, and your cpanel username is sam, the end result for the database name is sam_books and for the username is sam_george

So, the rest of it would look something like:

$mysqldbname = "sam_books";
$mysquser = "sam_george";
$mysqpassword = "12345";

The password isn't changed at all.

If you didn't use the wizard to set up the database, you need follow these 3 steps:

1.  Create the database
2.  Create the user/password
3.  Assign the user to the database

Often the third step is missed which causes it not to work.
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

Server Error Codes

There are a number of cryptic server errors that are displayed that don't give you any...

Repair/Optimize a database

There's a couple ways you can repair/optimize a database. phpMyAdmin click on the appropriate...