--skip-name-resolve
Do not resolve host names when checking client connections. Use only IP addresses. If you use this option, all Host column values in the grant tables must be IP addresses or localhost. See Section 7.9.8, “How MySQL Uses DNS”.
--skip-networking
Do not listen for TCP/IP connections at all. All interaction with mysqld must be made using named pipes or shared memory (on Windows) or Unix socket files (on Unix). This option is highly recommended for systems where only local clients are permitted. See Section 7.9.8, “How MySQL Uses DNS”.
如果反解析很慢,则会造成很多请求unauthenticated user 在login状态
配置文件中加入
--skip-name-resolve
When a new client connects to mysqld
, mysqld
spawns a new thread to handle the
request. This thread first checks whether the host name is in the host name
cache. If not, the thread attempts to resolve the host name:
-
The thread takes the IP address and resolves it to a host name (using gethostbyaddr()
). It then takes that host name and
resolves it back to the IP address (using gethostbyname()
) and compares to ensure it is the original
IP address.
-
If the operating system supports the thread-safe gethostbyaddr_r()
and gethostbyname_r()
calls, the thread uses them to perform
host name resolution.
-
If the operating system does not support the thread-safe calls, the thread
locks a mutex and calls gethostbyaddr()
and gethostbyname()
instead. In this case, no other thread can
resolve host names that are not in the host name cache until the first thread
unlocks the mutex.
You can disable DNS host name lookups by starting mysqld
with the --skip-name-resolve
option. However, in this case, you
can use only IP addresses in the MySQL grant tables.
If you have a very slow DNS and many hosts, you can get more performance by
either disabling DNS lookups with --skip-name-resolve
or by increasing the HOST_CACHE_SIZE
define (default value: 128) and recompiling
mysqld
.
You can disable the host name cache by starting the server with the --skip-host-cache
option. To clear the host name cache,
issue a FLUSH HOSTS
statement or execute the mysqladmin
flush-hosts
command.
To disallow TCP/IP connections entirely, start mysqld
with the --skip-networking
option.
分享到:
相关推荐
MySQL中的`skip-name-resolve`模式是一个配置选项,它的主要作用是禁止数据库服务器在处理连接请求时进行DNS(域名系统)解析。这个设置通常用于优化性能,因为DNS查询可能会增加延迟,尤其是在网络环境不稳定或者...
MySQL数据库系统在配置时,有时为了提高性能或者避免DNS解析带来的延迟,会在配置文件`my.ini`中启用`skip-name-resolve`选项。这个选项的作用是禁止MySQL服务器对远程主机名进行DNS解析,而是直接使用IP地址进行...
最近在Linux服务器上安装MySql5后,本地使用客户端连MySql...附:How MySQL uses DNS When a new thread connects to mysqld, mysqld will spawn a new thread to handle the request. This thread will first check
作为MySQL调优的一部分,很多人都推荐开启skip_name_resolve。这个参数是禁止域名解析的(当然,也包括主机名)。很多童鞋会好奇,这背后的原理是什么,什么情况下开启这个参数比较合适。 基于以下原因,MySQL服务端...
当面临DNS解析速度慢或客户端主机数量众多的情况时,可以考虑使用`--skip-name-resolve`选项启动MySQL服务来禁用DNS主机查找。这样,您只能在MySQL权限表中使用IP地址,而不能使用域名。请注意,禁用DNS解析后,所有...
赠送jar包:netty-resolver-dns-4.1.65.Final.jar; 赠送原API文档:netty-resolver-dns-4.1.65.Final-javadoc.jar; 赠送源代码:netty-resolver-dns-4.1.65.Final-sources.jar; 赠送Maven依赖信息文件:netty-...
MySQL中的`SKIP-NAME-RESOLVE`参数是一个用于优化连接速度的配置选项,但它也可能在某些情况下导致用户权限问题。这个参数的作用是禁止MySQL服务器在处理客户端连接时执行DNS解析,从而避免因DNS查询带来的延迟。...
赠送jar包:netty-resolver-dns-4.1.65.Final.jar; 赠送原API文档:netty-resolver-dns-4.1.65.Final-javadoc.jar; 赠送源代码:netty-resolver-dns-4.1.65.Final-sources.jar; 赠送Maven依赖信息文件:netty-...
mysql-connector-java-8.0.23-下载 rpm包
java连接mysql的稳定驱动
MySQL Connector/J 8.0.26 是 MySQL 官方提供的用于 Java 应用程序的 JDBC 驱动,它允许 Java 开发人员通过 Java Database Connectivity (JDBC) API 连接到 MySQL 数据库。这个驱动程序是开源的,并且遵循 GNU ...
当你通过`Class.forName()`方法加载驱动时,这个类会被初始化,使得Java应用程序能够建立到MySQL服务器的连接。 2. **数据库连接**:使用`DriverManager.getConnection()`方法,你可以创建到MySQL服务器的连接,...
赠送jar包:netty-codec-dns-4.1.65.Final.jar; 赠送原API文档:netty-codec-dns-4.1.65.Final-javadoc.jar; 赠送源代码:netty-codec-dns-4.1.65.Final-sources.jar; 赠送Maven依赖信息文件:netty-codec-dns-...
赠送jar包:netty-resolver-dns-4.1.74.Final.jar; 赠送原API文档:netty-resolver-dns-4.1.74.Final-javadoc.jar; 赠送源代码:netty-resolver-dns-4.1.74.Final-sources.jar; 赠送Maven依赖信息文件:netty-...
为了解决这个问题,可以在MySQL配置文件(通常为`my.ini`或`my.cnf`)的`[mysqld]`部分添加`skip-name-resolve`选项。这将禁用DNS查询,从而加快连接速度。然而,这样做也可能带来副作用,如已存在的使用主机名的...