Ultra Web Hosting Docs

The WordPress Database

WordPress keeps your posts, pages, settings, and users in a MySQL database. Knowing where its credentials live and how to work with a few key tables lets you recover from lockouts and fix common problems.

Finding Your Credentials

WordPress stores its database connection details in the wp-config.php file in the root of your site. Open it with cPanel File Manager or FTP and look for these four lines:

define( 'DB_NAME', 'cpuser_wp' );
define( 'DB_USER', 'cpuser_wpuser' );
define( 'DB_PASSWORD', 'your-password-here' );
define( 'DB_HOST', 'localhost' );

The Table Prefix

Just below the credentials you will find the table prefix:

$table_prefix = 'wp_';

By default WordPress tables begin with wp_ — for example wp_posts, wp_options, and wp_users. Some installs use a custom prefix for security, so always check this value before running SQL against the tables. In the examples below, substitute your actual prefix if it is not wp_.

Changing the Database Password

If you rotate the database user's password, you must update it in two places or WordPress will lose its connection:

  1. In cPanel, open MySQL Databases, find the user under Current Users, and click Change Password. Set a new strong password.
  2. Edit wp-config.php and update the DB_PASSWORD line to match exactly.
  3. Save the file and reload your site to confirm it connects.
Note A mismatch between the cPanel password and wp-config.php produces the Error establishing a database connection message. Make sure both values are identical.

Common Tasks in phpMyAdmin

Open phpMyAdmin from cPanel and select your WordPress database before running any of the following.

Reset an Administrator Password

If you are locked out and cannot use the email reset, set a new password directly. Run this in the SQL tab, replacing the values as needed:

UPDATE wp_users SET user_pass = MD5('NewPassword123') WHERE user_login = 'admin';

WordPress accepts the MD5 hash and upgrades it to a stronger hash the next time you log in.

Fix the Site URL

If your site redirects to the wrong domain after a move, correct the siteurl and home values in wp_options:

UPDATE wp_options SET option_value = 'https://example.com' WHERE option_name IN ('siteurl', 'home');

The Built-in Repair Tool

WordPress ships with a repair page that can fix a corrupted database without any SQL. It is disabled by default. To turn it on, add this line to wp-config.php, above the line that reads /* That's all, stop editing! */:

define('WP_ALLOW_REPAIR', true);

Then visit /wp-admin/maint/repair.php on your site and click Repair Database (or Repair and Optimize).

Warning The repair page does not require a login while WP_ALLOW_REPAIR is enabled, so anyone who finds the URL can run it. Remove the line from wp-config.php as soon as you are done.
Warning Editing the database directly is powerful and irreversible. Always export a backup of the WordPress database before changing rows, resetting passwords, or running repair. If something goes wrong, you can restore the copy or contact our support team.