Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

What Is a MySQL Hostname and How to Find It

This guide explains the MySQL hostname and shows you three ways to find yours.

Databases2 min read10 steps3 screenshots

What is a MySQL hostname?

MySQL is a popular kind of database. A database is a digital store where a website keeps its information.

A hostname is the name of the computer that holds the database. It is like the street address of a house. When your website wants its data, it uses the hostname to find the right place.

Apps like WordPress ask for the hostname when you set them up. You will see it written as DB_HOST, Database Host or MySQL Hostname.

Screenshot: Apps like WordPress ask for the hostname when you set them up. You will see it written as

The usual answer

On most shared hosting, the database lives on the same server as your website. In that case the hostname is:

localhost

This word means "this same computer". Try it first. It works for most people.

When it is not localhost

Some plans keep the database on a separate server. Then the hostname is a longer name or a number. If you connect from outside your server, you also need a remote hostname. Your welcome email or Hostvento support will tell you the correct one.

Way 1: check your welcome email

  1. Open the welcome email you got when you bought hosting.
  2. Look for words like "MySQL host" or "database server".
    Screenshot: Look for words like "MySQL host" or "database server".

Way 2: look in your website's config file

If your site already works, the answer is in its settings file.

  1. Log in to your hosting control panel and open File Manager.
  2. Go to the folder that holds your website. It is often named public_html.
  3. For WordPress, open the file wp-config.php. Right-click it and choose Edit.
  4. Find the line that has DB_HOST. The value in the quotes is your hostname.
  5. Close the file without making changes.
define( 'DB_HOST', 'localhost' );

This line tells WordPress that the database host is localhost.

Way 3: ask phpMyAdmin

  1. Open phpMyAdmin from the Databases section of your control panel.
  2. Click the Home icon, or the Server link at the top.
  3. Look at the line that says Server. It shows the hostname.
Tip: If the site says "Error establishing a database connection", the hostname may be wrong. Check it first. If it is right, open a support ticket.

Quick recap

  • The MySQL hostname is the address of your database server.
    Screenshot: The MySQL hostname is the address of your database server.
  • Most shared hosting uses localhost.
  • Find it in your welcome email, in wp-config.php, or in phpMyAdmin.
  • Ask Hostvento support if your plan uses a different host.