Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How to change paths to files in mysql database?

Quote Reply
How to change paths to files in mysql database?
Hi,
I've managed to get my links kind of working again, though I have stored files in the mysql database and they each have them stored with paths like:
/home/user1/domain1/content/

and I need to change all of them to
/home/user2/support/domain1/content

due to the change to a new server and paths being all different.

Can someone tell me a easy sql statment that I can run in phpmyadmin that will change all references of the first path to the path that I want.
Quote Reply
Re: [kamidan] How to change paths to files in mysql database? In reply to
Something like this:


Code:
update Links set Url='/home/user2/support/domain1/content' where Url='/home/user1/domain1/content/'

BACKUP YOUR DATA BEFORE TRY ANY CHANGE!!!
Use DUMP to save your table.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Blondies can have brains (sometimes...)
Quote Reply
Re: [kamidan] How to change paths to files in mysql database? In reply to
Code:
UPDATE lsql_Links_Files
SET File_Directory = REPLACE(File_Directory,"/home/user1/domain1/content/","/home/user2/support/domain1/content/")
WHERE File_Directory LIKE '%/home/user1/domain1/content/%'

Again, be sure to backup your data - in case this doesn't do what you want! (you can just backup the lsql_Links_Files table).

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!