Home > Database > Mysql Tutorial > Briefly explain the understanding of WordPress database and the commands used

Briefly explain the understanding of WordPress database and the commands used

php是最好的语言
Release: 2018-08-02 14:07:13
Original
2487 people have browsed it

WordPress started as a simple blogging platform. After more than ten years, it has evolved into a content management system that is used by many novices and experts. Even many high-end websites are built on this platform. It can integrate and implement almost everything you can Most functions that come to mind.

The biggest advantage is that WordPress installation, configuration, database creation, etc. do not require users to have programming knowledge or basic theory. However, sometimes you will find that having some basic database knowledge will help you achieve the purpose of optimizing your website.

WordPress Database

phpMyAdmin is the first choice for many DBAs [database administrators] to create databases, but when it comes to paying attention to SQL query statements, not everyone likes to use phpMyAdmin.

You should already know that WordPress uses a MySQL database. Before using it, you need to log in first. You can enter the following command on the command line to log in:

mysql -u [user_name] -p -D [database_name]

After logging in, you can view all Data table, use the following command to view:

desc [table_name]

Also note that the table prefix is ​​the default wp, which represents WordPress. Make sure your prefix is ​​correct, if you used a different prefix.

Let’s browse the data table sorted alphabetically.

1) wp_options

Configuration table, this table saves all configuration information:

Title title

Tagline tag

Timezone Time Zone

All database displays displayed on the dashboard are collected and stored in this specific table.

2) wp_users

User table, as you can see from the table name, this table stores all registered user information, including the following information:

Log-in ID User ID

Encrypted password Hashed password

E-mail ID User email address

Contact numbers Contact number

Registration date and time Registration time

Display name Display name

Status Status

Activation key Activation code

3) wp_usermeta

The user extended information table stores some extended user information, such as last_name, which is not stored in the wp_users table.

The following fields are the differences that need to be noted in this table:

meta_key

meta_value

4) wp_posts

Article table, this table stores all articles and pages of the website, including historical versions, and the navigation menu is also stored in this table. Different post types are distinguished using the post_type field.

5) wp_postmeta

The article attribute table stores the metadata of all articles. For example, the tag data generated by some SEO plug-ins will be stored in this table.

6) wp_terms

The categories and tags corresponding to articles, links, and pages are stored in this table. They are usually called slugs, and their values ​​will be reflected in Among the hyperlinks, the effect of Google spider search pages will eventually be improved to achieve the purpose of optimization.

7) wp_term_relationships

Attribute relationship table, this table stores the mapping relationship between [tag/category] and [article/page].

8) wp_term_taxonomy

This table stores the mapping relationship between taxonomy [Taxonomy] and term.

Translator’s Note:

Example:

You have created a new article, the category is fruit, and the default Taxonomy of this article is called category

You have created a new article, the category is vegetables. The Taxonomy of this article remains unchanged and is still called category

At this time, you want to create a series of Articles about cars do not want to be confused with the original list of food articles.

Then you can create a new post_type at this time, with the value of car and Taxonomy of power.

Specific adding method You can search for the usage of the function register_post_type in the official documentation,

Then add two articles, classified into battery and gas,

In this way, there will be a new mapping relationship record in the table wp_term_taxonomy.

The SQL statement when querying food is category=fruit

The SQL statement when querying cars is power=battery

9) wp_comments

Stores comments on all pages, including those that have not been reviewed, and other information filled in when commenting; it should be noted that if you use a third-party comment system such as Disqus, the comments will not be stored here. Inside the table.

10) wp_commentmeta

Like other metadata tables, this table stores the extended metadata of comments.

11) wp_links

This table stores customized link information and requires the installation of a link management [Links Manager] plug-in, although its use is no longer recommended.

A few tips

Modify the default user name

WordPress does not allow you to modify the user name, but you can modify it by executing a SQL statement.

Change password

If you forget the administrator password, you can easily restore it by modifying the database. Note that the password must be digested using the MD5 hash algorithm.

Delete all spam comments

Sometimes spam comments will give you a headache, you can use a plug-in like Akismet to monitor and manage, but if you have a lot of spam comments, you can use SQL Come clean.

Check the source of spam comments

In short, this article hopes to make novice administrators no longer confused about databases. Although there are countless plug-ins available today, don't use them blindly. You should first consider the easiest way to solve your needs.

Related articles:

MySQL database common commands simple and super practical version

Use the MySQL command line to back up and restore the database

The above is the detailed content of Briefly explain the understanding of WordPress database and the commands used. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template