mysql

MySQL find and replace data in drupal database

Case: in drupal I had to move a complete site (in single site configuration) from one server to another server (in multisite configuration).

All the files included in files/(single site configuration) were moved to a new directory sites/mydomain.com/files/ (multisite configuration).

At this point the path in the field filepath in the files table of the mysql database was not pointing to the correct place. I had to find and replace all values in filepath field to the new correct directory with the following mysql command:

How to move your MySQL database directory to another directory

If you have a dedicated server with a second Hard Drive then you can often achieve better performance (reduce io wait issues) if you move your MySQL databases to the second Hard Drive.

This was done on a server with CentOS operating system.
Let’s say your second HDD is mounted as /home2
1. The first step is to stop MySQL so that all your data gets copied correctly.

$ /etc/rc.d/init.d/mysql stop
- or -
$ service mysql* stop

Syndicate content