Monday, May 25, 2015

If I have user/host pair "root@", is it necessary to keep "root@localhost" in the mysql host/users table? (multi-part Q)

On computer "dexwin10", the user@host pair is as follows:



root@dexwin10 

root@%

root@localhost



When people install our software, we want them to be able to access the database from computers other than just their own. This tells me localhost should not be given as the hostname, but I'm unsure which of the other two to use.



Questions:



1A.) Is root@dexwin10 the same as root@localhost if my computer's name is dexwin10? Or does root@dexwin10 mean I can only login/access the database from the machine dexwin10, which would make sense since you can only login to root@localhost from the localhost.



B.) If I'm supposed to use root@dexwin10 and not root@localhost, does this mean root@localhost can be deleted? Or do I need localhost present to prevent problems?



2.) Should I specify the hostname "%" during our software's installation where it asks us for the hostname containing the database we wish to use, or should I enter "dexwin10"? What could be some side effects of entering just "%" as the hostname?




3.(optional) if root@(MachineName) and root@% are the same, why doesn't the MySQL installer make the default host whatever your computer's name is, and not some seemingly random string called "localhost"?



I tried to figure out why there were 3 hosts for root (one with my computer name, one with %, and one with localhost) and all the answers are talking about the default mysql users/hosts. These are not the default users.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...