Results 1 to 6 of 6

Thread: Need WordPress SQL statement

  1. #1
    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.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,949

    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.

  3. #3
    Join Date
    May 2008
    Posts
    2,015

    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";

  4. #4
    Join Date
    Apr 2008
    Posts
    2,010

    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;

  5. #5
    Join Date
    May 2008
    Posts
    2,302

    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.

  6. #6
    Join Date
    Oct 2005
    Posts
    2,394

    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',

Similar Threads

  1. What is an Atomic Statement and how to use it?
    By JustBorN55 in forum Software Development
    Replies: 4
    Last Post: 04-02-2011, 12:42 PM
  2. How to use Else and Else If Statement in PHP?
    By Orton in forum Software Development
    Replies: 5
    Last Post: 05-03-2010, 05:49 AM
  3. How to use If statement in PHP?
    By Deabelos in forum Software Development
    Replies: 4
    Last Post: 09-02-2010, 05:14 AM
  4. what is wordpress? How to install Newer versions of wordpress.
    By Gill_christ in forum Technology & Internet
    Replies: 3
    Last Post: 21-05-2009, 02:40 PM
  5. Replies: 4
    Last Post: 25-02-2009, 07:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •