PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 19th, 2001, 04:10 PM
SammyK's Avatar
SammyK SammyK is offline
Happy Monkey
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2001
Location: UK (University of Kentucky)
Posts: 1,810 SammyK User rank is Sergeant Major (2000 - 5000 Reputation Level)SammyK User rank is Sergeant Major (2000 - 5000 Reputation Level)SammyK User rank is Sergeant Major (2000 - 5000 Reputation Level)SammyK User rank is Sergeant Major (2000 - 5000 Reputation Level)SammyK User rank is Sergeant Major (2000 - 5000 Reputation Level)SammyK User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 23 h 15 m 26 sec
Reputation Power: 42
Changing localhost IP address for MySQL

I am moving a bunch of my database sites to a new server. I have to keep the databases hot durring the switch. Is there a way to change the IP address of 'localhost' to another IP address when you connect in PHP to MySQL? That way I wouldn't have to change 'localhost' to the new IP address on every script.

Thanks In Advance!
Sam Powers
__________________

Reply With Quote
  #2  
Old December 19th, 2001, 04:56 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,966 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 49 m 46 sec
Reputation Power: 186
yes, there is. But youŽd rather not.
"localhost" is used by many services and programs to connect to other services and programs on the same machine.

you could do something in your /etc/hosts like changing
"127.0.0.1 localhost"
to
"192.168.1.10 localhost"

but you better do a full-text search-and-replace to the FQDN if you donŽt want to **** up the system or if you donŽt own the machine you do this on:

for i in /home/myname/*.php; do cat "$i"|sed -e "s/localhost/mynewname/g" > "/tmp/phptmp"; cat /tmp/phptmp >"$i"; done; rm -f /tmp/phptmp

using bash. (make backups BEFORE!)

and:
use mysql; update hosts set host="your-name.de" where host="localhost";
and then tell mysql to reload the grant tables. (mysqladmin is your friend...)

(dont use this literally. i am at home right now and dont have mysql running on my new system yet!!!)

using Win****? - dont do it. weŽll find another solution.

Reply With Quote
  #3  
Old December 19th, 2001, 05:11 PM
SammyK's Avatar
SammyK SammyK is offline
Happy Monkey
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2001
Location: UK (University of Kentucky)
Posts: 1,810 SammyK User rank is Sergeant Major (2000 - 5000 Reputation Level)SammyK User rank is Sergeant Major (2000 - 5000 Reputation Level)SammyK User rank is Sergeant Major (2000 - 5000 Reputation Level)SammyK User rank is Sergeant Major (2000 - 5000 Reputation Level)SammyK User rank is Sergeant Major (2000 - 5000 Reputation Level)SammyK User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 23 h 15 m 26 sec
Reputation Power: 42
Thanks. I own both the machines - the one I am currently using and the one I am moving to, and they are both running Linux, just like at home. Linux all the way, baby!!! Down with Microgay!!

This isn't a PHP question, but I forgot how to do a search and replace on all the files in a directory from the Kernel... do you think you could help me on that one?

Thanks Again!
Sam Powers

Reply With Quote
  #4  
Old December 19th, 2001, 05:20 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,966 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 49 m 46 sec
Reputation Power: 186
this is not a kernel but a bash question.

see the "for i in ..." line. i think this is what you are asking for.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Changing localhost IP address for MySQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
Stay green...Green IT