您现在的位置是:主页 > news > 网站改标题不改版 k/seo快速排名利器

网站改标题不改版 k/seo快速排名利器

admin2025/5/23 20:51:14news

简介网站改标题不改版 k,seo快速排名利器,破洛洛wordpress,石家庄网站开发建设简介用过MySQL数据库朋友一定对“ERROR 1040 (HY000): Too many connections”,这个报错不陌生,出现这个报错的原因有两种情况,一种是单个用户的连接数超过“max_user_connections”参数定义值,另外一种情况是,所有应用…

网站改标题不改版 k,seo快速排名利器,破洛洛wordpress,石家庄网站开发建设简介用过MySQL数据库朋友一定对“ERROR 1040 (HY000): Too many connections”,这个报错不陌生,出现这个报错的原因有两种情况,一种是单个用户的连接数超过“max_user_connections”参数定义值,另外一种情况是,所有应用…

简介

用过MySQL数据库朋友一定对“ERROR 1040 (HY000): Too many connections”,这个报错不陌生,出现这个报错的原因有两种情况,一种是单个用户的连接数超过“max_user_connections”参数定义值,另外一种情况是,所有应用的连接数超过“max_connections”参数定义值。

如果是第二种情况,MySQL数据库还提供一个额外连接,这个连接只有super角色的用户能登录,例如root用户,使用root用户登录数据库之后,就可以进行故障定位。但是如果由于管理不规范,应用程序使用了super角色用户连接数据,当出现“ERROR 1040 (HY000): Too many connections”报错之后,大家想想,会发生什么,这个时候DBA使用root用户都登录数据库,就很难做故障定位了,去解决连接不足的问题。

c575b40d191221ab452e5627062d0a87.png

MySQL8新增管理端口

在MySQL8以前的版本,由于应用用户和管理用户共同使用同一个端口服务,没有进行隔离,如果使用不规范时,很容易造成DBA无法用root用户连接数据库,进行故障定位。

在MySQL8的版本,MySQL官方考虑到这个问题,于是就给数据库管理人员独立起了一个管理端口服务,这样应用用户和管理用户访问的端口进行隔离,互不影响。

MySQL8管理端口启用

要启用MySQL8管理端口,只需要在my.cnf配置文件中添加3个参数

admin_address=127.0.0.1admin_port=33306create_admin_listener_thread=1mysql> show variables like '%admin%';+---------------------------------+-------------------------------+| Variable_name                   | Value                         |+---------------------------------+-------------------------------+| admin_address                   | 127.0.0.1                     || admin_port                      | 33306                         || admin_ssl_ca                    |                               || admin_ssl_capath                |                               || admin_ssl_cert                  |                               || admin_ssl_cipher                |                               || admin_ssl_crl                   |                               || admin_ssl_crlpath               |                               || admin_ssl_key                   |                               || admin_tls_ciphersuites          |                               || admin_tls_version               | TLSv1,TLSv1.1,TLSv1.2,TLSv1.3 || create_admin_listener_thread    | ON                            || log_slow_admin_statements       | OFF                           || persist_only_admin_x509_subject |                               |+---------------------------------+-------------------------------+14 rows in set (0.01 sec)

下面就来测试一下,当报"ERROR 1040 (HY000): Too many connections"错误之后,DBA是否还能使用管理端口连接数据库

1.模拟会话总数已经达到max_connections参数定义阀值

mysql> show variables like '%connections%';+------------------------+-------+| Variable_name          | Value |+------------------------+-------+| max_connections        | 3     || max_user_connections   | 2     || mysqlx_max_connections | 100   |+------------------------+-------+3 rows in set (0.01 sec)mysql> show global status like 'Threads_connected';+-------------------+-------+| Variable_name     | Value |+-------------------+-------+| Threads_connected | 3     |+-------------------+-------+1 row in set (0.01 sec)

2.使用MySQL数据库额外提供的端口,root连接数据库

root@19dd973af376:~# mysql -uroot -prootmysql: [Warning] Using a password on the command line interface can be insecure.Welcome to the MySQL monitor.  Commands end with ; or g.Your MySQL connection id is 32Server version: 8.0.21 MySQL Community Server - GPLCopyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.mysql> show global status like 'Threads_connected';+-------------------+-------+| Variable_name     | Value |+-------------------+-------+| Threads_connected | 4     |+-------------------+-------+1 row in set (0.01 sec)

此时,root用户已经使用了MySQL数据库的额外连接,如果再使用root用户连接数据,就会报错了

root@19dd973af376:~# mysql -uroot -prootmysql: [Warning] Using a password on the command line interface can be insecure.ERROR 1040 (HY000): Too many connections

3.使用管理端口连接数据库

root@19dd973af376:~# mysql -uroot -proot -P 33306 -h127.0.0.1mysql: [Warning] Using a password on the command line interface can be insecure.Welcome to the MySQL monitor.  Commands end with ; or g.Your MySQL connection id is 33Server version: 8.0.21 MySQL Community Server - GPLCopyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.mysql> show global status like 'Threads_connected';+-------------------+-------+| Variable_name     | Value |+-------------------+-------+| Threads_connected | 5     |+-------------------+-------+1 row in set (0.03 sec)

可以看到root用户还可以通过管理端口33306进行登录了,当前的连接数总数也到了5个,超过了max_connections定义的3个。

关注

1.如果您喜欢这篇文章,请点赞+转发。

2.如果您特别喜欢,请加关注。