wanjichun 2020-02-13
查看最大连接数: show variables like ‘max_connect%‘;
查看当前连接数: show status like ‘Threads%‘;
修改mysql的连接数:
vim /etc/my.cnf
[mysqld] #设置编码格式 [mysqld] #设置编码格式 character-set-server=utf8 #数据存储目录 datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock #开启慢查询 slow_query_log =1 #设置慢查询时间,超过2秒就是慢查询 long_query_time = 2 #慢查询日志文件存储路径 slow_query_log_file=/var/run/mysqld/mysqld-slow.log user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # 将默认的连接数改成500 max_connections = 500 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [client] default-character-set=utf8 [mysql] default-character-set=utf8
然后重启mysql : service mysqld restart ; (centos6)