Server IP. How to configure?

Server IP. How to configure?

Postby Wasington Povoa » Tue 07 Jun 2005 17:21

To configure the Server parameter in TMyConnection I need the Server IP. My computer has differents Client IP and Server IP (127.0.0.1).
Mysqladmin shows Client IP. How can I configure the Server IP?
Wasington Povoa
 

Postby swierzbicki » Wed 08 Jun 2005 06:35

? Could you be a little bit more explicit ?
Do you have mutliple Network Card on your PC ?

You can works with a Client + MySQL server on the same PC. Just enter the localhost / 127.0.0.1 IP address
swierzbicki
 
Posts: 451
Joined: Wed 19 Jan 2005 09:59

IP informations

Postby Washington Povoa » Wed 08 Jun 2005 11:33

Only one network card, on a Dell computer.
Server Information: MySQL 4.0.13-nt via TCP/IP; Network Name: localhost; IP: 127.0.0.1
Client Information: MySQL Client Version 5.0.5; IP:192.168.7.106

All servers have default IP 127.0.0.1. I need change the value to permit access differents PCs.
Washington Povoa
 

Re: Server IP. How to configure?

Postby RodolfoArias » Wed 08 Jun 2005 19:34

I use this routine en delphi.

function GetIPFromHost (var HostName, IPaddr, WSAErr: string): Boolean;
type
Name = array[0..100] of Char;
PName = ^Name;
var
HEnt: pHostEnt;
HName: PName;
WSAData: TWSAData;
i: Integer;
begin
Result := False;
if WSAStartup($0101, WSAData) <> 0 then begin
WSAErr := 'Winsock no está respondiendo."';
Exit;
end;
IPaddr := '';
New(HName);
if GetHostName(HName^, SizeOf(Name)) = 0 then begin
HostName := StrPas(HName^);
HEnt := GetHostByName(HName^);
for i := 0 to HEnt^.h_length - 1 do IPaddr := Concat(IPaddr,IntToStr(Ord(HEnt^.h_addr_list^[i])) + '.');
SetLength(IPaddr, Length(IPaddr) - 1);
Result := True;
end
else begin
case WSAGetLastError of
WSANOTINITIALISED:WSAErr:='WSANotInitialised';
WSAENETDOWN :WSAErr:='WSAENetDown';
WSAEINPROGRESS :WSAErr:='WSAEInProgress';
end;
end;
Dispose(HName);
WSACleanup;
end; { GetIPFromHost }
RodolfoArias
 

Postby swierzbicki » Thu 09 Jun 2005 06:40

So you have an Network (as i understood it).
There is no more to do, just "use" the Server Lan IP address.
If your Server IP is 192.168.7.1 then, in each MySQL Client, use '192.168.7.1' as the server address.
swierzbicki
 
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Postby Ikar » Thu 09 Jun 2005 12:34

If MySQL server is located at the same machine with your application then you can set server property to 'localhost'.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56


Return to MySQL Data Access Components