美文网首页数据库
mysql 调优脚本 tuning-primer.sh

mysql 调优脚本 tuning-primer.sh

作者: SkTj | 来源:发表于2019-11-11 09:11 被阅读0次

tuning-primer.sh是一个mysql的脚本
官网: https://launchpad.net/mysql-tuning-primer/
百度搜索的文档不是从这个网站下载的,具体的不清楚,小松感觉这个网站比较靠谱,右边绿色的按钮下载
或者用wget下载

<pre class="prettyprint linenums prettyprinted" style="padding: 8px; font: 400 12px/20px "courier new"; color: rgb(248, 248, 212); border-radius: 0px; display: block; margin: 20px 0px; word-break: break-all; overflow-wrap: break-word; white-space: pre-wrap; background: rgb(39, 40, 34); border: 1px solid rgb(39, 40, 34); overflow: hidden; box-shadow: rgb(57, 56, 46) 40px 0px 0px inset, rgb(70, 71, 65) 41px 0px 0px inset; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

  1. wget https://launchpad.net/mysql-tuning-primer/trunk/1.6-r1/+download/tuning-primer.sh

</pre>

将tuning-primer.sh拷贝到my.cnf同级目录,我的目录在my.cnf在/etc目录下

<pre class="prettyprint linenums prettyprinted" style="padding: 8px; font: 400 12px/20px "courier new"; color: rgb(248, 248, 212); border-radius: 0px; display: block; margin: 20px 0px; word-break: break-all; overflow-wrap: break-word; white-space: pre-wrap; background: rgb(39, 40, 34); border: 1px solid rgb(39, 40, 34); overflow: hidden; box-shadow: rgb(57, 56, 46) 40px 0px 0px inset, rgb(70, 71, 65) 41px 0px 0px inset; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

  1. cp tuning-primer.sh /etc

  2. chmod +x tuning-primer.sh

  3. cd /etc

  4. ./tuning-primer.sh

</pre>

执行出现如下错误

<pre class="prettyprint linenums prettyprinted" style="padding: 8px; font: 400 12px/20px "courier new"; color: rgb(248, 248, 212); border-radius: 0px; display: block; margin: 20px 0px; word-break: break-all; overflow-wrap: break-word; white-space: pre-wrap; background: rgb(39, 40, 34); border: 1px solid rgb(39, 40, 34); overflow: hidden; box-shadow: rgb(57, 56, 46) 40px 0px 0px inset, rgb(70, 71, 65) 41px 0px 0px inset; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

  1. Using login values from ~/.my.cnf

    • INITIAL LOGIN ATTEMPT FAILED -
  2. Testing for stored webmin passwords:

  3. None Found

  4. Could not auto detect login info!

  5. Found potential sockets: /tmp/mysql.sock

  6. Using: /tmp/mysql.sock

  7. Would you like to provide a different socket?: [y/N] n

  8. Do you have your login handy ? [y/N] : y

  9. User: root

  10. Password: 123456

  11. Would you like me to create a ~/.my.cnf file for you? [y/N] : n

    • FINAL LOGIN ATTEMPT FAILED -
  12. Unable to log into socket: /tmp/mysql.sock

</pre>

问题是
mysqladmin 命令根本就没有,需要带上路径,修改一下脚本,
224行

<pre class="prettyprint linenums prettyprinted" style="padding: 8px; font: 400 12px/20px "courier new"; color: rgb(248, 248, 212); border-radius: 0px; display: block; margin: 20px 0px; word-break: break-all; overflow-wrap: break-word; white-space: pre-wrap; background: rgb(39, 40, 34); border: 1px solid rgb(39, 40, 34); overflow: hidden; box-shadow: rgb(57, 56, 46) 40px 0px 0px inset, rgb(70, 71, 65) 41px 0px 0px inset; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

  1. mysqladmin="mysqladmin -S socket -u admin -p(cat /etc/psa/.psa.shadow)"
  2. 修改成
  3. mysqladmin="/usr/local/mysql/bin/mysqladmin -S socket -u admin -p(cat /etc/psa/.psa.shadow)"

</pre>

227行

<pre class="prettyprint linenums prettyprinted" style="padding: 8px; font: 400 12px/20px "courier new"; color: rgb(248, 248, 212); border-radius: 0px; display: block; margin: 20px 0px; word-break: break-all; overflow-wrap: break-word; white-space: pre-wrap; background: rgb(39, 40, 34); border: 1px solid rgb(39, 40, 34); overflow: hidden; box-shadow: rgb(57, 56, 46) 40px 0px 0px inset, rgb(70, 71, 65) 41px 0px 0px inset; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

  1. mysqladmin="/usr/local/mysql/bin/mysqladmin"
  2. 修改成
  3. mysqladmin="mysqladmin"

</pre>

在执行tuning-primer.sh脚本的时候就没有问题了

生成的报告会有建议,根据自己的实际情况来修改

下面是我报告的截图,报告很长,可仔细看一下

[图片上传失败...(image-d30b52-1573309202929)]

相关文章

网友评论

    本文标题:mysql 调优脚本 tuning-primer.sh

    本文链接:https://www.haomeiwen.com/subject/yeqobctx.html