My server is centos 7.4, mysql 5.5.
In my.cnf
,I set skip-name-resolve = 0
and skip-networking= 1
,which means mysql will use [email protected]
even I run user@localhost
.
Then, when I create a new user, which one is better, user@localhost
or [email protected]
?
Also, you can find root@localhost
,[email protected]
,root@::1
in a newly installed mysql.Actually there should be only one root user.Which one should be use?
This is not interchangeable. If you connect to MySQL via TCP, you need to use
@127.0.0.1
and if you use unix sockets, you use@localhost
.I tried to answer this question based on my understanding.
If you web server is same as the mysql server, then you'd better use
@localhost
.And,
skip-name-resolve = 1
is necessary if you use@localhost
.