Where Are SQL Statements in WordPress?

WordPress is a dynamic content management system, meaning that the main content -- including the posts, pages and category structure -- is kept in a MySQL database, separate from the main theme files. Because of this, it is possible to make changes to the site content by using SQL statements, as well as the traditional way of using the administration control panel.

  1. Permissions to phpMyAdmin

    • You can only access phpMyAdmin if you own the WordPress site, or if the site owner has given you access. This is done through your Web hosting providers administration area, often through a service like cPanel. PhpMyAdmin cannot be accessed on a WordPress blog hosted on the WordPress.com site, nor on a blog network unless you are the Super Admin. If you are on a WordPress network, contact the network owner and ask if you can have access to phpMyAdmin.

    SQL Statements in phpMyAdmin

    • Before you can make SQL commands and queries in your WordPress database, you must first access the command line editor. Log in to phpMyAdmin, then click the name of your database from the drop-down menu on the left of the screen. Click the “SQL” tab, which reveals the command line. Type your statement into the “Run SQL query/queries on database,” then click the “Go” button at the bottom right of the screen. The results are displayed just below the query box.

    Backing Up

    • It is good practice to back up the database before making any changes to the MySQL database for your WordPress site. This way, if you make a mistake, you can simply replace the backup version and restore the site to its previous state. To do this, click”Export” from within phpMyAdmin, then click “SQL.” Click “Save as file,” “gzipped” and the “Go” button. A window appears asking where you want to save the file. Choose a location, then click “Save.”

    Editing wp-Config.php

    • Some statements regarding the WordPress MySQL database are contained in the "wp-config.php" file. Log in to your FTP program, then navigate to your blog's home directory. Click “wp-config.php,” then edit. Statements here include “DB_NAME,” or the name of the database, “DB_USER,” or the database username, “DB_PASSWORD,” or the password for the database and “DB_HOST,” which is a network setting that varies between hosting companies but is usually set to "localhost."

Related Searches

References

  • Photo Credit Stockbyte/Stockbyte/Getty Images

Related Ads

Check It Out

7 Tips for Photographing Your Kids on Halloween