Where to find your MySQL credentials

Your MySQL username and password are usually stored in one of three places: a setup email from your hosting provider, a configuration file on your server, or your hosting account dashboard. The location depends on how you set up MySQL — whether your hosting company installed it for you, or you installed it yourself on a server you control.

If you set up MySQL through a hosting provider like GoDaddy, Bluehost, or HostGator, they sent you a welcome email with your username and password when you first signed up. Search your email for messages from your host containing "MySQL" or "database". If you installed MySQL yourself on a Linux or Windows server, you chose the password during installation, and it is not stored anywhere else — you will need to reset it if you have forgotten it.

Key Takeaways

  • Hosting providers send MySQL credentials in a welcome email; search for messages containing "MySQL", "database", or your domain name.
  • The username is often your account username or a variation like accountname_db, and the password is a string you either set yourself or received from your host.
  • If you installed MySQL yourself, check the configuration file my.cnf (Linux) or my.ini (Windows) for the root password, though it is usually not stored in plain text.
  • Your hosting account dashboard usually has a section called "MySQL Databases" or "Database Manager" where you can view or reset your credentials.
  • If you have lost the password, most hosting providers let you reset it through their control panel without needing the old one.

Check your hosting account dashboard

Log into your hosting provider's control panel — usually cPanel, Plesk, or a custom dashboard. Look for a section labeled "MySQL Databases", "Database Manager", "phpMyAdmin", or "Manage Databases". This section lists all databases you have created and shows the username associated with each one.

In cPanel, click "MySQL Databases" and scroll to the section called "Current Users". You will see a list of usernames. The password is not displayed here for security reasons, but you can reset it by clicking the username and entering a new password. In Plesk, go to "Databases" and click the database name to see its user account. Again, you cannot see the password, but you can change it.

If your host uses a custom dashboard, look for any section with "database" in the name. If you cannot find it, contact your hosting support — they can tell you where to look or provide your credentials directly.

Search your email for the original setup message

When you first created a MySQL database through your hosting account, your provider sent you a confirmation email. This email usually contains your database name, username, and sometimes the password. Search your email inbox and spam folder for messages from your hosting company that mention "MySQL", "database", "welcome", or your domain name.

The email typically says something like "Your MySQL database has been created" or "Database credentials for your account". It may list the information in a table or as plain text. If you find it, write down the username and password exactly as shown — they are case-sensitive.

If you cannot find the email, check your email provider's archive or recovery options. Gmail, Outlook, and most other providers let you search deleted items. If the email is truly gone, you will need to reset the password through your hosting dashboard.

Reset your password if you have lost it

Most hosting providers let you reset your MySQL password without knowing the old one. Log into your hosting dashboard, find the MySQL Databases section, and look for an option to "Change Password", "Reset Password", or "Edit User". Click it, enter a new password, and save.

The new password takes effect when ready. Use this new password the next time you connect to MySQL through a tool like phpMyAdmin, a command line, or your website's database connection file. If you are running MySQL on your own server and do not have access to a control panel, you will need to use the command line to reset the root password — this process varies by operating system and MySQL version, and your server administrator or hosting support can walk you through it.

Check your website's database connection file

If your website is already connected to MySQL, the credentials are stored in a configuration file on your server. For WordPress sites, this file is called wp-config.php. For other PHP applications, look for a file named config.php, database.php, settings.php, or connection.php.

You can view this file by connecting to your server using SFTP (a find file transfer tool) or by using your hosting provider's file manager in the control panel. Open the file in a text editor and look for lines that say DB_USER, DB_PASSWORD, DB_NAME, or DB_HOST. The values next to these are your database username, password, database name, and server address.

Be careful not to edit this file unless you know what you are doing — changing the wrong thing can break your website. If you are not comfortable with this step, ask your hosting support to tell you what the credentials are.

Understand the difference between MySQL and hosting account credentials

Your MySQL username and password are separate from your hosting account username and password. Your hosting account username is what you use to log into your control panel. Your MySQL username is what you use to connect to a specific database. They are often different, and they have different passwords.

For example, your hosting account might be myaccount, but your MySQL username might be myaccount_wordpress or db_user_1. If you are trying to connect to MySQL and your hosting account credentials are not working, you are using the wrong username and password — you need the MySQL ones instead.

Frequently Asked Questions

What if I never set up MySQL myself and do not see it in my hosting dashboard?

MySQL may not be installed on your hosting plan, or it may be included but not yet activated. Contact your hosting support and ask whether MySQL is available on your plan. If it is, they can create a database and send you the credentials. If it is not, you may need to upgrade your plan.

Can I see my MySQL password after I have set it?

No. For security reasons, hosting providers and MySQL do not display passwords after they are set. If you need to know your password, you must reset it to a new one. Write down the new password somewhere safe, like a password manager.

Is the MySQL username the same as the database name?

No. The database name and username are separate. You can have one username with access to multiple databases, or multiple usernames with access to the same database. Check your hosting dashboard to see which username is assigned to which database.

What does localhost mean in the MySQL server address?

Localhost means the MySQL server is running on the same machine as your website. If you see "localhost" or "127.0.0.1" as the server address, it means your website and database are on the same server. Some hosting providers use a different server address like mysql.yourhost.com — use whatever address your hosting provider gives you.

Do I need both a username and password to connect to MySQL?

Yes. MySQL requires both a username and password for every connection. Some tools or applications may let you save these credentials so you do not have to type them every time, but both are required to log in.