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)
  • 相关阅读:
    技术必备:推荐一款接口自动化测试数据校验神器
    提高GUI自动化测试稳定性解决方案
    新特性,推荐一款超强接口管理神器 Apifox
    测试开发:从0到1学习如何测试API网关
    接口自动化测试,一键快速校验接口返回值全部字段
    测试工程师必学:测试人员如何深入了解项目
    Django+Vue+Docker搭建接口测试平台实战
    如何开展线上全链路压测思路分享
    刚转行1年测试新手:学习Python编程经验实战分享
    测开新手:从0到1,自动化测试接入Jenkins学习
  • 原文地址:https://www.cnblogs.com/cnxy168/p/11646770.html
Copyright © 2011-2022 走看看