Server IP. How to configure?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Wasington Povoa

Server IP. How to configure?

Post by 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?

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by 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

Washington Povoa

IP informations

Post by 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.

RodolfoArias

Re: Server IP. How to configure?

Post by 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^)) + '.');
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 }

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by 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.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by 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'.

Post Reply