问题描述
我的MySQL数据库需要两个用户:appuser和support.
应用程序开发人员之一坚持要求我为这些用户创建四个帐户:
My MySQL database needs two users: appuser and support.
One of the application developers insists that I create four accounts for these users:
appuser@'%'
appuser@'localhost'
support@'%'
support@'localhost'
对于我的一生,我不知道为什么他认为我们需要这个.不会使用通配符作为主机来处理本地主机"吗?
For the life of me I can't figure out why he thinks we need this. Wouldn't using the wildcard as the host take care of the 'localhost'?
有什么想法吗?
(在此处使用MySQL 5.5)
(Using MySQL 5.5 here)
推荐答案
localhost
在MySQL中是特殊的,它表示通过UNIX套接字(或Windows上的命名管道)的连接,而不是TCP/IP.插座.将%
用作主机不包含localhost
,因此需要显式指定它.
localhost
is special in MySQL, it means a connection over a UNIX socket (or named pipes on Windows, I believe) as opposed to a TCP/IP socket. Using %
as the host does not include localhost
, hence the need to explicitly specify it.
这篇关于创建MySQL用户时使用%作为主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!