摘要:
CentOS+Mysql 8.0.18
tail -200f /var/log/mysqld.log
日志信息显示警告
2020-04-02T06:59:08.994775Z 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 10000 (requested 10010)
2020-04-02T06:59:08.994794Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 3995 (requested 4000)
2020-04-02T06:59:09.345447Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18) starting as process 11083
2020-04-02T06:59:10.567181Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-04-02T06:59:10.656613Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.18' socket: '/var/lib/mysql/mysql.sock' port: 6612 MySQL Community Server - GPL.
2020-04-02T06:59:10.850059Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
查看数据库:
[root@mysqldb2 ~]# mysql -uroot -p
mysql> show variables like '%open%'; +----------------------------+-------+ | Variable_name | Value | +----------------------------+-------+ | have_openssl | YES | | innodb_open_files | 3995 | | mysqlx_port_open_timeout | 0 | | open_files_limit | 10000 | | table_open_cache | 3995 | | table_open_cache_instances | 16 | +----------------------------+-------+ 6 rows in set (0.01 sec) mysql>
[root@mysqldb2 ~]# find / -name mysqld.service
/sys/fs/cgroup/pids/system.slice/mysqld.service
/sys/fs/cgroup/devices/system.slice/mysqld.service
/sys/fs/cgroup/systemd/system.slice/mysqld.service
/etc/systemd/system/multi-user.target.wants/mysqld.service
/usr/lib/systemd/system/mysqld.service
编辑:
[root@mysqldb2 ~]# vi /usr/lib/systemd/system/mysqld.service
找到LimitNOFILE
# Sets open_files_limit
LimitNOFILE = 65535
重新加载服务配置文件
[root@mysqldb2 ~]# systemctl daemon-reload
重启mysql服务
[root@mysqldb2 ~]# systemctl restart mysqld.service
[root@mysqldb2 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 46
Server version: 8.0.18 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> show variables like '%open%';
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| have_openssl | YES |
| innodb_open_files | 4000 |
| mysqlx_port_open_timeout | 0 |
| open_files_limit | 65535 |
| table_open_cache | 4000 |
| table_open_cache_instances | 16 |
+----------------------------+-------+
6 rows in set (0.02 sec)
mysql>