惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

I
Intezer
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
H
Heimdal Security Blog
I
InfoQ
Blog — PlanetScale
Blog — PlanetScale
Apple Machine Learning Research
Apple Machine Learning Research
Spread Privacy
Spread Privacy
腾讯CDC
大猫的无限游戏
大猫的无限游戏
Recent Announcements
Recent Announcements
V
Vulnerabilities – Threatpost
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
Google Developers Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
J
Java Code Geeks
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
V
Visual Studio Blog
Microsoft Azure Blog
Microsoft Azure Blog
Google Online Security Blog
Google Online Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
W
WeLiveSecurity
宝玉的分享
宝玉的分享
aimingoo的专栏
aimingoo的专栏
博客园_首页
S
Security @ Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Recent Commits to openclaw:main
Recent Commits to openclaw:main
P
Privacy International News Feed
H
Hacker News: Front Page
Vercel News
Vercel News
T
Troy Hunt's Blog
Forbes - Security
Forbes - Security
N
News and Events Feed by Topic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
U
Unit 42
Cloudbric
Cloudbric
MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
T
Threat Research - Cisco Blogs
C
Cyber Attacks, Cyber Crime and Cyber Security
Schneier on Security
Schneier on Security
Last Week in AI
Last Week in AI
H
Help Net Security
M
MIT News - Artificial intelligence
美团技术团队

博客园 - My Data Support

用户中心 - 博客园 ORACLE版本说明 ORACLE KILL回话 MOS文章分类整理 如何在 SQL Server 2005 实例之间传输登录和密码 只导出表结构的SQL语句 查询大字段对象脚本 BMC监控的一个坑 RAC环境下创建本地数据文件的解决方法 如何清理监听日志 RMAN基于时间点的恢复 RAC一个节点添加本地监听地址 ORACLE坏块检查 远程访问数据库查询数据量一大就Hang 什么时候会刷新备库控制文件refresh the standby database control file? Why AIXTHREAD_SCOPE Should Be Set To 'S' On AIX 在一个RAC集群中最多支持多少节点 Database name和SID Oracle Semaphore Management in UNIX Administration
动态修改MYSQL配置参数
My Data Support · 2017-05-31 · via 博客园 - My Data Support

mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。

修改会话级变量

用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数

mysql> show variables like '%sort_buffer_size%';
+---------------------------+------------+
| Variable_name             | Value      |
+---------------------------+------------+
| sort_buffer_size          | 6291448    |
+---------------------------+------------+
1 rows in set (0.00 sec)

用set SESSION命令设置会话级变量的新值

mysql> set SESSION sort_buffer_size=7000000;
Query OK, 0 rows affected (0.00 sec)

--修改会话级变量对当前会话来说立刻生效
mysql> show variables like '%sort_buffer_size%';        
+---------------------------+------------+
| Variable_name             | Value      |
+---------------------------+------------+
| sort_buffer_size          | 7000000    |
+---------------------------+------------+
1 rows in set (0.00 sec)

mysql> exit
Bye
退出重新连接后,此参数恢复原值
[root@devdbc_stb root]# mysql
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 40 to server version: 5.0.37-log

Type 'help;' or '/h' for help. Type '/c' to clear the buffer.

mysql> show variables like '%sort_buffer_size%';        
+---------------------------+------------+
| Variable_name             | Value      |
+---------------------------+------------+
| sort_buffer_size          | 6291448    |
+---------------------------+------------+
1 rows in set (0.00 sec)

修改全局变量
[root@devdbc_stb root]# mysql
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 40 to server version: 5.0.37-log

Type 'help;' or '/h' for help. Type '/c' to clear the buffer.

mysql> show variables like '%sort_buffer_size%';        
+---------------------------+------------+
| Variable_name             | Value      |
+---------------------------+------------+
| sort_buffer_size          | 6291448    |
+---------------------------+------------+
1 rows in set (0.00 sec)

用set GLOBAL 命令设置全局变量

mysql> set GLOBAL sort_buffer_size = 7000000;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like '%sort_buffer_size%';         
+---------------------------+------------+
| Variable_name             | Value      |
+---------------------------+------------+
| sort_buffer_size          | 6291448    |
+---------------------------+------------+
1 rows in set (0.00 sec)
当前此参数的值并不发生变化,先退出,然后重新连进去
mysql> exit
Bye
[root@devdbc_stb root]# mysql
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 41 to server version: 5.0.37-log

Type 'help;' or '/h' for help. Type '/c' to clear the buffer.

mysql> show variables like '%sort_buffer_size%';
+---------------------------+------------+
| Variable_name             | Value      |
+---------------------------+------------+
| sort_buffer_size          | 7000000    |
+---------------------------+------------+
1 rows in set (0.00 sec)
新的参数值生效

 新的参数值生效 这些参数的改变在重启MYSQL服务的时候,都将失效复原,如果想要重启的时候也载入,则需要修改配置文件。

转载:http://blog.chinaunix.net/uid-26263325-id-3027255.html