Forum Moderators: coopster & phranque

Message Too Old, No Replies

mysql - what is difference between localhost and server name

         

jamie

9:48 am on Mar 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi,

can anyone please explain what the difference is between localhost and servername, e.g. when i connect via ssh to my server

mysql -h localhost -u root -p

i then enter my normal password and it allows me in to mysql

but when i do

mysql -h myservername.net -u root -p

it won't allow me to connect with any password.

yet when i look at user root on Host myservername.net in phpMyAdmin it says Password No, but of course this user has privileges on all databases. is this a security risk? should i set a password for this user, and should (must) it be the same as the password for localhost?

many thanks

Xuefer

10:27 am on Mar 28, 2003 (gmt 0)

10+ Year Member



for *nix
localhost use AF_UNIX (/tmp/mysql.sock)
domain use AF_INET (ip)

jamie

10:33 am on Mar 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



sorry xuefer, but you've lost me there. i'm a beginner ;-)

Allen

10:34 am on Mar 28, 2003 (gmt 0)

10+ Year Member



I believe he's saying: It's slightly faster to use localhost if the mysql server is on the same machine, because the machine doesn't bother doing any domain name lookups or going through the TCP/IP protocol.

Allen

jamie

11:10 am on Mar 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi allen,

it is not quite what i was after, but still good to know.

i think i have answered my own question anyway. i only need to use the servername.net if i connect from another machine

i have also just set a password, so i think the security issues are solved too.

cheers

Allen

1:18 pm on Mar 28, 2003 (gmt 0)

10+ Year Member



Gah, it's just like all my IT exams I took, I answer the question but it's not the answer they want o_O

Allen