Skip to content Skip to main navigation Skip to footer

How to Manage a WordPress Database

The WordPress database is a vital piece of the puzzle that allows a WordPress site to load. This is where unique data is stored pertaining to a WordPress site that houses custom information, ranging from WP admin users to unique posts and pages. Managing the database is an essential task when troubleshooting a WordPress site. This is where you can easily switch the theme and find your WordPress version. In this guide we will explore ways to manage the WordPress database through free & reliable software that can be accessed through your hosting account or browser. The two recommended pieces of software to manage a database are Adminer and PHPMyAdmin.

PHPMyAdmin

PHPMyAdmin is a common piece of software used to manage databases. You can view and download this software on their verified website. This software is often preinstalled on many hosting servers for easy access to manage databases. For example, PHPMyAdmin can be found on cPanel accounts underneath the Database section, like so:

To manage your WordPress database through PHPMyAdmin, select this software which will lead you onto a page similar to this:

You can then click on the plus sign to the left of the database name which will expand multiple database tables that you can view and change:

NOTE:

Be very cautious when managing a database and always have a backup before performing any actions within PHPMyAdmin.

Adminer

Adminer is a piece of software used to manage a WordPress database. It is not as common as PHPMyAdmin, but is quite useful and easy to use as it is only one single PHP file. To utilize Adminer, all you need to do is upload the PHP file to your file structure and access it via a browser directly on your site. First, download a copy of the latest version here:

Navigate to your WordPress file structure and upload the single PHP file into your webroot, like so:

Load your website along with the PHP file:

In a separate window or tab, load your WordPress file structure and view the wp-config.php file which contains unique database credentials to allow you to log in and manage your database. This file will be located within the WordPress webroot:

Here is an example wp-config.php file. Yours will look similar but contain unique database credentials to connect the WordPress database to its file structure.

<?php
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the installation.
 * You don't have to use the web site, you can copy this file to "wp-config.php"
 * and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * Database settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://wordpress.org/support/article/editing-wp-config-php/
 *
 * @package WordPress
 */

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );

/** Database username */
define( 'DB_USER', 'username_here' );

/** Database password */
define( 'DB_PASSWORD', 'password_here' );

/** Database hostname */
define( 'DB_HOST', 'localhost' );

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/**#@+
 * Authentication unique keys and salts.
 *
 * Change these to different unique phrases! You can generate these using
 * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
 *
 * You can change these at any point in time to invalidate all existing cookies.
 * This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );

/**#@-*/

/**
 * WordPress database table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the documentation.
 *
 * @link https://wordpress.org/support/article/debugging-in-wordpress/
 */
define( 'WP_DEBUG', false );

/* Add any custom values between this line and the "stop editing" line. */



/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
	define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

Enter in each database credential within the login prompt through adminer.php. Once logged in, Adminer will appear as so:

You can then manage your WordPress database by selecting any applicable table to the left, along with exporting or importing a backup if necessary.

NOTE:

Make sure to remove the adminer.php file after you are done managing your database. Leaving this file accessible to the public can lead to possible security issues.