Tuesday, August 26, 2014

mysql case sensitive query

MySQL queries are not case-sensitive by default. Following is a simple query that is looking for 'value'. However it will return 'VALUE', 'value', 'VaLuE', etc…

SELECT * FROM `table` WHERE `column` = 'value'

The good news is that if you need to make a case-sensitive query, it is very easy to do:

SELECT * FROM `table` WHERE BINARY `column` = 'value'



Monday, August 11, 2014

Move WordPress From Local Server to Live Site

Changing the Site URL:

Need to change the site URL, so you can setup your live WordPress site. In your phpMyAdmin, look for the wp_options table in your database.

Click on the browse button next to wp_options or the link that you see in the sidebar to open the page with a list of fields within the wp_options table. See screenshot below:




Under the field options_name, you need to look for siteurl. Click the Edit Field icon which can be found at the far left at the beginning of the row.
                           


Setting Up your Live Site:
Connect to your website using an FTP client and edit wp-config.php file. Provide the database name, user and password you created 
                        
                         /** The name of the database for WordPress */
                         define('DB_NAME', 'database_name_here');

                       /** MySQL database username */
                        define('DB_USER', 'username_here');

                      /** MySQL database password */
                        define('DB_PASSWORD', 'password_here');


Login to your WordPress admin panel, and go to Settings » General. Click save Options. This will ensure that the site url is corrected anywhere else that needs to be.
Then go to Settings » Permalink and click Save to ensure that all post links are working fine.

Fixing Images and Broken Links by updating Paths:

Whenever you are moving a WordPress site from one domain to another, or from local server to a live site, you would face broken links and missing images issue.
Here is a simple SQL query that should solve this problem:
UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/test/', 'www.yourlivesite.com/');


That’s all, hopefully your live site will be up and running by now. Checkout your site to make sure that every thing is working fine as expected.

Special thanks to wordpress .