First, do not restart the database to modify database parameters, but also require a restart after the entry into force
We need to modify the parameters of the database, and then modify the parameters of the configuration file, so that the database remains in effect restart
[root@localhost bak]# grep key_buffer /etc/my.cnf key_buffer_size = 16K key_buffer_size = 8M [root@localhost bak]# mysql -uroot -pdubin Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 110 Server version: 5.5.32-log Source distribution Copyright (c) 2000, 2013, 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 'key_buffer%'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | key_buffer_size | 16384 | +-----------------+-------+ 1 row in set (0.00 sec) mysql> set global key_buffer_size=1024*1024*32; Query OK, 0 rows affected (0.00 sec) mysql> show variables like 'key_buffer%'; +-----------------+----------+ | Variable_name | Value | +-----------------+----------+ | key_buffer_size | 33554432 | +-----------------+----------+ 1 row in set (0.00 sec) mysql> quit Bye [root@localhost bak]# mysql -uroot -pdubin Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 111 Server version: 5.5.32-log Source distribution Copyright (c) 2000, 2013, 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 'key_buffer%'; +-----------------+----------+ | Variable_name | Value | +-----------------+----------+ | key_buffer_size | 33554432 | +-----------------+----------+ 1 row in set (0.00 sec) mysql> quit Bye [root@localhost bak]# /etc/init.d/mysqld restart Shutting down MySQL.... SUCCESS! Starting MySQL.^[[A......... SUCCESS! [root@localhost bak]# mysql -uroot -pdubin Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.32-log Source distribution Copyright (c) 2000, 2013, 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 'key_buffer%'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | key_buffer_size | 16384 | +-----------------+-------+ 1 row in set (0.00 sec) mysql> set global key_buffer_size=1024*32; Query OK, 0 rows affected (0.00 sec) mysql> quit Bye [root@localhost bak]# vi /etc/my.cnf [root@localhost bak]# /etc/init.d/mysqld restart Shutting down MySQL. SUCCESS! Starting MySQL.. SUCCESS! [root@localhost bak]# mysql -uroot -pdubin Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.32-log Source distribution Copyright (c) 2000, 2013, 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 'key_buffer%'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | key_buffer_size | 32768 | +-----------------+-------+ 1 row in set (0.00 sec)