Using % for host when creating a MySQL user(创建 MySQL 用户时使用 % 作为主机)
问题描述
我的 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'
就我的一生而言,我无法弄清楚他为什么认为我们需要这个.主机不会使用通配符来处理 '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 用户时使用 % 作为主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:创建 MySQL 用户时使用 % 作为主机


- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- SQL 临时表问题 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01