加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

MySQL内存及虚拟内存优化设置

发布时间:2020-12-12 00:02:39 所属栏目:MySql教程 来源:网络整理
导读:p style="border:0px;list-style:none;line-height:21px;color:rgb(50,62,50);font-family:simsun;font-size:14px;" span style="line-height:30px;font-size:20px;"mysql 优化调试命令 p style="border:0px;list-style:none;line-height:21px;color:rgb(50,

<p style="border:0px;list-style:none;line-height:21px;color:rgb(50,62,50);font-family:simsun;font-size:14px;">
<span style="line-height:30px;font-size:20px;">mysql 优化调试命令


<p style="border:0px;list-style:none;line-height:21px;color:rgb(50,50);font-family:simsun;font-size:14px;">
?


<p style="border:0px;list-style:none;line-height:21px;color:rgb(50,50);font-family:simsun;font-size:14px;">
1、


<p style="border:0px;list-style:none;line-height:21px;color:rgb(50,50);font-family:simsun;font-size:14px;">
mysqld --verbose --help


<p style="border:0px;list-style:none;line-height:21px;color:rgb(50,50);font-family:simsun;font-size:14px;">
这个命令生成所有mysqld选项和可配置变量的列表


<p style="border:0px;list-style:none;line-height:21px;color:rgb(50,50);font-family:simsun;font-size:14px;">
2、


<p style="border:0px;list-style:none;line-height:21px;color:rgb(50,50);font-family:simsun;font-size:14px;">
通过连接它并执行这个命令,可以看到实际上使用的变量的值:


<pre style="color:rgb(50,50);font-size:14px;line-height:21px;"><span style="font-family:'Courier New';">mysql>?SHOW VARIABLES;
<p style="border:0px;list-style:none;line-height:21px;color:rgb(50,50);font-family:simsun;font-size:14px;">
还可以通过下面的语句看到运行服务器的统计和状态指标:


<pre style="color:rgb(50,50);font-size:14px;line-height:21px;"><span style="font-family:'Courier New';">mysql>SHOW STATUS
<p style="border:0px;list-style:none;line-height:21px;color:rgb(50,50);font-family:simsun;font-size:14px;">
使用mysqladmin还可以获得系统变量和状态信息:


<pre style="color:rgb(50,50);font-size:14px;line-height:21px;"><span style="font-weight:bold;"><span style="font-family:'Courier New';">shell>?mysqladmin variables
<pre style="color:rgb(50,50);font-size:14px;line-height:21px;"><span style="font-family:'Courier New';">shell>?mysqladmin extended-status
<p style="border:0px;list-style:none;line-height:21px;color:rgb(50,50);font-family:simsun;font-size:14px;">
shell>?mysqladmin flush-table?命令可以立即关闭所有不使用的表并将所有使用中的表标记为已经关闭,这样可以有效释放大多数使用中的内存。FLUSH
TABLE
在关闭所有表之前不返回结果。


<p style="border:0px;list-style:none;line-height:21px;color:rgb(50,50);font-family:simsun;font-size:14px;">
swap -s检查可用交换区


<p style="border:0px;list-style:none;line-height:21px;color:rgb(50,50);font-family:simsun;font-size:14px;">
<span style="line-height:30px;font-size:20px;">mysql内存计算公式


<p style="border:0px;list-style:none;line-height:21px;color:rgb(50,50);font-family:simsun;font-size:14px;">
?


<div style="color:rgb(50,50);font-family:simsun;font-size:14px;line-height:21px;">

mysql used mem = key_buffer_size + query_cache_size + tmp_table_size
+ innodb_buffer_pool_size + innodb_additional_mem_pool_size
+ innodb_log_buffer_size
+ max_connections * (
read_buffer_size + read_rnd_buffer_size
+ sort_buffer_size+ join_buffer_size
+ binlog_cache_size + thread_stack
)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读