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 用户时使用 % 作为主机


基础教程推荐
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01