Tag Archive: MySQL


For those who have had to move wordpress you probably have found it a little tedious as there is no quick way to pick it up and move to another server.  Well I have moved a bunch of sites from my development server to their respective production environments so I have the process down.  Below is a checklist of how to move from server to server.

  1. Move all the files from the WordPress directory to the main server (I find it easier to zip everything the transfer that one file and then unzip on the server)
  2. Edit the wp-config.php file in the root folder to have the correct connection information on the new server
  3. Dump the database to a file using the mysqldump command (See Post)
  4. Re-import the dumped data file to the new server using the mysql command (See Post)
  5. Log into the production server and run the following two SQL lines:
    1. update wp_posts set post_content = replace(post_content,’DEVSERVERURL‘,’PRODSERVERURL‘);
    2. update wp_options set option_value = replace(option_value,’DEVSERVERURL‘,’PRODSERVERURL‘);
  6. Log into WordPress Admin and double check all the general settings (if you use nextgen you have to re-input everything manually)
  7. Turn off your Dev server (This one is key so you know that you can see if you have any image or anything references pointed back to your old server)

MySQL Dump and Load Commands

logo-mysqlI have had to do this a lot lately with all the database work I have been doing so I figured I would write this down before I forgot about it.

If you need to restore a database from a .sql file here is the command:

mysql -h hostname -u username -pthepassword databasename < dumpfile.sql

If you need to dump a database to a file (for automated backup purposes) you can use this command:

mysqldump -h hostname -u username -pthepassword databasename > backup-file.sql

These can be very helpful when doing database work

MySQL – Find and Replace Statement

50px-Edit-find-replace.svgThe other day I had to move a blog from one server to another and found out that WordPress sometimes likes to hard code the server address into things like links and images.  I found this handy little SQL statement you can run to find and replace anything that you need changed:

update [Table] set [Column] = replace([column],’[old text]‘,’new text’);

This can save you a lot of heart ache dealing with moving servers and find out that you have a lot of broken images left after migration.

Navicat Front End to MySQL

This is a great front end to MySQL and imports and exports super easy. Navicat

Third Party Apps for DBMS

image

So this is the best third party apps I know about for MySQL, MS-SQL Server, Postgre, and Firebird if you are into the third party apps for Windows. I like these because they have code completion which makes writing SQL much faster and accurate. All are free applications from http://www.sqlmanager.net/

EMS mySQL lite
EMS SQL Server lite

Powered by WordPress | Theme: Motion by 85ideas.