At 11:27 -0400 8/24/04, Michael Stassen wrote:
No, there is no option to control the client's apparent hostname.
Considering that restricting the allowable connecting hosts is part
of mysql's access control mechanism, this makes sense.
Whether your client hostname is localhost or a domain name/ip
address is controlled by your connection method. By default, mysql
connects to the server on localhost via unix socket. When
connecting this way, the client hostname is localhost, as well. If
you specify a domain name/ip address of the server with -h, however,
you connect to that server via tcp/ip, so the client hostname is
your domain name/ip address.
So, you can accomplish what you want. If you and the mysql server
are on myhost.mydomain.com,
mysql -h myhost.mydomain.com -u jonas -p
connects you to the server via tcp/ip, with myhost.mydomain.com as
the connecting hostname.
That said, I can't think of any reason why you would want to do
this. tcp/ip adds overhead, so it is less efficient. In other
words, connecting to localhost is the default partly because it's
better. No doubt you do have a reason for wanting this, but there
may be a better solution. If you told us why you want your
connection to appear to come from your hostname (tcp/ip) instead of
from localhost (unix socket), someone might suggest a better way.
To connect to a local server using TCP/IP, you can also specify a host of
127.0.0.1 to use the loopback interface.
One reason to do this is when you are connecting to a replication master
running on the same machine. If you specify "localhost", the connection
tries to use the socket file and any port specification gets ignored. If
you use 127.0.0.1, the port specification will be used.
Michael
Jonas Ladenfors wrote:
Hello, Is there someway to specify which domain one would like to connect
from in the mysql console. When connecting on my server I always get
connected through localhost. I would like to connect through my DNS name.
quasi example : mysql -u [EMAIL PROTECTED] -p
regards
/Jonas
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]