Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Need WordPress SQL statement

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 23-02-2010
Member
 
Join Date: Feb 2010
Posts: 533
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.

Reply With Quote
  #2  
Old 23-02-2010
Member
 
Join Date: Apr 2008
Posts: 1,947
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.
Reply With Quote
  #3  
Old 23-02-2010
Member
 
Join Date: May 2008
Posts: 2,007
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";
Reply With Quote
  #4  
Old 23-02-2010
Member
 
Join Date: Apr 2008
Posts: 2,000
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;
Reply With Quote
  #5  
Old 23-02-2010
Member
 
Join Date: May 2008
Posts: 2,291
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.
Reply With Quote
  #6  
Old 23-02-2010
Member
 
Join Date: Oct 2005
Posts: 2,389
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',
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Need WordPress SQL statement"
Thread Thread Starter Forum Replies Last Post
What is an Atomic Statement and how to use it? JustBorN55 Software Development 4 04-02-2011 12:42 PM
How to use Else and Else If Statement in PHP? Orton Software Development 5 05-03-2010 05:49 AM
How to use If statement in PHP? Deabelos Software Development 4 09-02-2010 05:14 AM
what is wordpress? How to install Newer versions of wordpress. Gill_christ Technology & Internet 3 21-05-2009 02:40 PM
What is the difference between while statement & do statement? Athos Software Development 4 25-02-2009 07:52 PM


All times are GMT +5.5. The time now is 12:40 AM.