查看当前mysql的连接数:
[root@localhost ~]# /usr/bin/mysqladmin -u
root -p variables |grep max_connections
Enter
password:
| max_connections | 100 #我的目前是100
修改连接数:
[root@localhost ~]# vi /etc/my.cnf
在[mysqld]中加入:
set-variable=max_connections=3000
如:
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
max_connections=3000
重启mysql服务:
[root@localhost ~]# service mysql restart
再次查看连接数:
[root@localhost ~]# /usr/bin/mysqladmin -uroot -p variables |grep max_connections
| max_connections | 3000 #改过来了
版权声明:若无特殊注明,本文皆为( yueshuo )原创,转载请保留文章出处。