Need WordPress SQL statement
Hi all,
In the past ten years, MySQL has become a popular database, while the WordPress blog using a MySQL database, although the use of plug-in can solve some problems, but to achieve certain specific tasks, to execute SQL statements in php MyAdmin is the most simple way I need some useful SQL statements used to solve some practical problems encountered. Please help. Thanks in advance.
Need WordPress SQL statement
I(f you want to create a backup of the database, Go through the following methods can be simple backup database: Log in phpMyAdmin later. Choose your WordPress database, then click "Export" button, select a compression method (using gzip) and click the "executive" button, when prompted to download the browser when the point of "yes", the database file downloaded to the Local. Best of luck.
Need WordPress SQL statement
WordPress2.6 later added a Post revisions feature, though a bit used, but i suggested to amended to increase the size of your database, we can choose to delete in bulk. Log in phpMyAdmin execute the following SQL statement after the bulk can be removed.
Code:
DELETE FROM wp_posts WHERE post_type = "revision";
Need WordPress SQL statement
After you have WordPress installed, admin account is created, and many people are wrong to use this account to write blog, until they realize that this is not a personal account. First of all you have to find your correct user name, use the following SQL statements can be found in your user ID.
Code:
SELECT ID, display_name FROM wp_users;
Assuming that this ID for NEW_AUTHOR_ID, while the ID for the admin administrator OLD_AUTHOR_ID, then run the following SQL statement.
Code:
UPDATE wp_posts SET post_author = NEW_AUTHOR_ID WHERE post_author = OLD_AUTHOR_ID;
Need WordPress SQL statement
Many people in order to protect their blog is not being black-out, using a very complex password, Although this is a good thing, but it will happen often forgotten administrator password thing. Of course, by e-mail can be sent to you WordPress link to reset your password, but if you can not access your e-mail address, then had to use the following SQL statements to reset your password.
Code:
UPDATE wp_users SET user_pass = MD5 ( 'PASSWORD') WHERE wp_users.user_login = 'admin' LIMIT 1;
MD5 hash function is a built-in MySQL, is used to convert the password hash value.
Need WordPress SQL statement
You may sometimes want to change your blog's domain name, but WordPress for your domain name will be stored in a database, so you want to use the following SQL statements to modify the.
Code:
UPDATE wp_options SET option_value = replace (option_value, 'http://www.oldsite.com', 'http://www.newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
Then, you should use the following SQL will be articles GUID is also modified.
Code:
UPDATE wp_posts SET guid = replace (guid, 'http://www.oldsite.com', 'http://www.newsite.com');
Finally, use the following statement in the article where all the old domain name will be replaced with new domain name.
Code:
UPDATE wp_posts SET post_content = replace (post_content, 'http://www.oldsite.com',