Gadgets Magazine

How To Add WordPress Database Management with phpMyAdmin

Posted on the 12 April 2013 by Stephen Anyatonwu @StefnSylvester
As you know, WordPress is written in PHP, you can find templates to install quickly and also easy to find the plugin for web/ blog development, but I’m sure you’ve encountered the error while running a web/blog, and many other problems occur.
For those who know how to program, they can modify and fix bugs, so even for beginners, it will be difficult.
In this article I will guide beginners: How Add To WordPress Database Management with phpMyAdmin
images How To WordPress Database Management with phpMyAdmin

How Add To WordPress uses Database

WordPress uses PHP (programming language) to store and retrieve data from the database. The information stored in a WordPress database include: posts, pages, comments, categories, tags, custom fields, users, and other site options such as site urls etc. We will elaborate on this later in the tutorial when we cover all WordPress database tables.
When you first install WordPress, it asks you to provide your Database name, host, username, and password. This information is stored in the configuration file (wp-config.php).
 How To WordPress Database Management with phpMyAdmin
During the installation, WordPress uses the information you provide about the database to create tables and store default installation data inside those tables. After the installation, WordPress runs queries to this database to dynamically generate HTML pages for your website or blog. This is what makes WordPress extremely powerful because you don’t have to create a new .html file for each page that you want to create. WordPress handles everything dynamically.

Understanding WordPress Database Tables

Each WordPress installation has 11 default tables in the database. Each database table contains data for different sections, features, and functionality of WordPress. Looking at the structure of these tables, you can easily understand where different parts of your website are stored. Currently, a default WordPress installation creates the following tables:
Note: wp_ before each table name is the database prefix you choose during the installation. It can be different.
wp_commentmeta: This table contains meta information about comments posted on a WordPress website. This table has four fields meta_id, comment_id, meta_key, and meta_value. Each meta_id is related to a comment_id. One example of comment meta information stored is the status of comment (approved, pending, trash, etc).
wp_comments: As the name suggests this table contains your WordPress comments. It contains comment author name, url, email, comment, etc.
wp_links: To manage blogrolls create by earlier versions of WordPress or the Link Manager plugin.
wp_options: This table contains most of your WordPress site wide settings such as: site url, admin email, default category, posts per page, time format, and much much more. The options table is also used by numerous WordPress plugins to store plugin settings.
wp_postmeta: This table contains meta information about your WordPress posts, pages, and custom post types.
wp_posts: The name says posts but actually this table contains all post types or should we say content types. This table contains all your posts, pages, revisions, and custom post types.
wp_terms: WordPress has a powerful taxonomy system that allows you to organize your content. Individual taxonomy items are called terms and they are stored in this table. Example, your WordPress categories and tags are taxonomies, and each category and tag inside them is a term.
wp_term_relationships: This table manages relationship of WordPress post types with terms in wp_terms table. For example this is the table that helps WordPress determine post X is in Y category.
wp_term_taxonomy: This table defines taxonomies for terms defined in wp_terms table. For example if you have a term “WordPress Tutorials“, then this table contains the data that says it is associated with a taxonomy categories. In short this table has the data that helps WordPress differentiate between which term is a category, which is a tag, etc.
wp_usermeta: Contains meta information about Users on your website.
wp_users: Contains User information like username, password, user email, etc.

Managing WordPress Database using phpMyAdmin

phpMyAdmin is an open source software that provides a web based graphical user interface to manage your mySQL database. Most WordPress hosting providers have phpMyAdmin installed in their control panel. This allows users to easily access the database and perform common database management tasks.
All of our recommended web hosting providers use cPanel. To access phpMyAdmin in cPanel, scroll down to Databases and click on phpMyAdmin. This will open phpMyAdmin in a new browser tab.
 How To WordPress Database Management with phpMyAdmin
Clicking on Databases will show you a list of Databases you have created or have access to. Click on your WordPress Database, and it will show you the list of your WordPress Database tables.
 How To WordPress Database Management with phpMyAdmin
You can perform various tasks from phpMyAdmin such as find/replace a certain word in your post, repair your database, optimize your database, add new admin users, deactivate all plugins, change passwords etc etc etc.
Note: Before you change anything, you must make a database backup. There is no undo button. So just make the backup.

Creating a WordPress Database Backup using phpMyAdmin

To create a backup of your WordPress database from phpMyAdmin, click on your WordPress Database. On the top menu, click on the Export tab.
 How To WordPress Database Management with phpMyAdmin
In newer versions of phpMyAdmin, it will ask you for a export method. The quick method will export your database in a .sql file. In custom method it will provide you with more options and ability to download backup in compressed zip or gzip archive. We recommend using custom method and choosing zip as the compression method. The custom method also allows you to exclude tables from the database. Lets say if you used a plugin that created a table inside your WordPress database, then you can choose to exclude that table from the backup if you want.
 How To WordPress Database Management with phpMyAdmin
Your exported database file can be imported back into a different or the same database using phpMyAdmin’s import tab.

Creating a WordPress Backup using a Plugin

Keeping regular backups of your WordPress site is the best thing you can do for your WordPress security. While the WordPress database contains majority of your site information, it still lacks a fairly important element, images. All your images are stored in the uploads folder in your /wp-content/ directory. Even though the database has the information which image is attached where in the post, it is useless if the image folder doesn’t have those files.
Often beginners think that the database backup is all what they need. It is NOT true. You need to have a full site backup that includes your themes, plugins, and images.
NO, most hosting company do not keep daily backups.

Optimizing your WordPress Database in phpMyAdmin

After using WordPress for a while your database becomes fragmented. There are memory overheads which increases your overall database size and query execution time. For those of us who remember in the old PC days, you would notice that your computer would get faster once you use Disk Defragmenter. The MySQL database works in a similar way. It comes with a simple command that allows you to optimize your database. Go to phpMyAdmin and click on your WordPress Database. This will show you a list of your WordPress tables. Click on Check All link below the tables. Next to it there is a “With Selected” drop down, click on it and choose Optimize table.
 How To WordPress Database Management with phpMyAdmin
This will optimize your WordPress tables by defragmenting tables. It will make your WordPress queries run a little faster and slightly reduce the size of your database.

Other Things You can do Using phpMyAdmin

There are many things you can change in your WordPress website by changing values in Database using phpMyAdmin. However, it is highly recommended that you don’t ever do it unless it is absolutely necessary or if you know what you are doing. Make sure that you first back up your database before making any changes to your database.

Securing your WordPress Database

Before we get into this, we want to emphasize that every site can be hacked. However, there are certain measures you can take to make it a little harder. First thing that you can do to is to change WordPress database prefix. This can significantly reduce the chances of SQL injection attacks on your WordPress database because often hackers target sites in masses where they are targeting the default wp_ table prefix.
You should always choose a strong username and password for your MySQL. This will make it difficult for someone to get access to your database.
We hope that this guide helped improve your understanding of the WordPress database and how it works. While you may not need this guide right away, it always help to know how things work for the future. icon smile How To WordPress Database Management with phpMyAdmin

You Might Also Like :

Back to Featured Articles on Logo Paperblog

These articles might interest you :

Magazines