首先要明白两个方面;

状态和变量之间的区别是:变量有一定的范围值,可以在这个指定的范围值之间自定义值的大小;然而状态是只是一个值,并不能进行随意的自定义的变化,只能进行清零或者关闭记录的操作,而且状态值是用来记述某一个值的链接状态,访问情况等,并不能进行自定义:

show varilables是用来查询变量的;

例如:show variables like 'rpl%';查询变量rpl%变量的情况

MySQL之show varilables与show status之间的区别

更改变量的值:这里要注意的是有的变量的值可以在表上面更改之后直接生效,但是有的变量需要更改my.cnf配置文件之后,将数据库进行重启之后才能生效。这里的rpl变量是直接更改之后就可以生效。

MySQL之show varilables与show status之间的区别

下面附上rpl_srop_slave_timeout的官方解释:

You can control the length of time (in seconds) that STOP SLAVE waits before timing out by setting this variable. This can be used to avoid deadlocks between STOP SLAVE and other slave SQL statements using different client connections to the slave.
The maximum and default value of rpl_stop_slave_timeout is 31536000 seconds (1 year). The minimum is 2 seconds. Changes to this variable take effect for subsequent STOP SLAVE statements.
This variable affects only the client that issues a STOP SLAVE statement. When the timeout is reached, the issuing client returns an error message stating that the command execution is incomplete. The client then stops waiting for the slave threads to stop, but the slave threads continue to try to stop, and the STOP SLAVE instruction remains in effect. Once the slave threads are no longer busy, the STOP SLAVE statement is executed and the slave stops.

 

 

更改变量:set global rpl_stop_slave_timeout=设定值;

MySQL之show varilables与show status之间的区别

show status是用来查询状态的;

例如:show status like 'qcache%';查询qcache%状态的情况

MySQL之show varilables与show status之间的区别

 

 

 

相关文章: