zoukankan      html  css  js  c++  java
  • MySQL备份与恢复(8)不重启数据库修改数据库参数

    一、不重启数据库修改数据库参数,但是要求重启后还能生效

        需要先修改数据库的参数,然后再修改配置文件的参数,这样数据库重启依然生效

    [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)
  • 相关阅读:
    Storm
    Linux 网络配置
    .NET Remoting
    jwt
    new操作符
    元数据
    C# lock
    三十而立
    面试
    灯火
  • 原文地址:https://www.cnblogs.com/cnxy168/p/11646770.html
Copyright © 2011-2022 走看看