开发者

MySQL: host name universal change

I am making some updates to a php site which I did not design. I have a local copy of the site. At the top of each page there are settings for the host name for the db connection.

Is there someway I can setup a pointer to the remote address. The address is 'mysqlhost' for example and I want that to point to 'mysql.myhost.com'. I tried creating a HOST 开发者_运维技巧record for mysqlhost pointing to the IP address it resolves to but that doesn't work.

If I put 'mysql.myhost.com' in the connection it works. If I put that IP address it doesn't so that is probably why the HOST record idea doesn't work.

Other than creating a local copy of the DB is there a quick way so that I don't have to modify each file in my dev environment and then again when I redeploy?


It will probably be more maintainable if you do a global search and replace with your favorite text editor.

While you're doing that, put the connection info in a .inc file and change the current host info to a line that just includes the one .inc file.

Once you have done that, you can just change the .inc file (or have conditional logic in the .inc file to indicate DEV vs. PROD), so there's just one place to update when moving between environments.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜