更改max_connections的值

时间:2014-05-19 09:03:58

标签: mysql

我想通过/etc/my.cnf更改max_connections但似乎无效。

mysql> select variable_name, variable_value
       from global_variables
       where variable_name = 'max_connections';

+-----------------+----------------+
| variable_name   | variable_value |
+-----------------+----------------+
| MAX_CONNECTIONS | 300            |
+-----------------+----------------+

重新启动后......

$ sudo /usr/local/mysql/support-files/mysql.server restart
Shutting down MySQL
.... SUCCESS!
Starting MySQL
.. SUCCESS!

使用此配置文件。

$ cat /etc/my.cnf
[mysqld]
max_connections=500

我仍然得到300。

这是我的mysql版本:

mysql  Ver 14.14 Distrib 5.6.15, for osx10.7 (i386) using  EditLine wrapper

编辑(1):

键入“$ mysql --help | grep默认-A 1”我可以

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf

但我只有/etc/my.cnf

编辑(使用解决方案)(2):

使用“$ locate my.cnf”我可以看到我要编辑的配置文件必须是/usr/local/mysql-5.6.15-osx10.7-x86/my.cnf修改此文件中的max_connections我成功获取500作为MAX_CONNECTION值

mysql> select variable_name, variable_value
       from global_variables
       where variable_name = 'max_connections';

+-----------------+----------------+
| variable_name   | variable_value |
+-----------------+----------------+
| MAX_CONNECTIONS | 500            |
+-----------------+----------------+

0 个答案:

没有答案