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;">
</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;">
-
cp tuning-primer.sh /etc
-
chmod +x tuning-primer.sh
-
cd /etc
-
./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;">
-
Using login values from ~/.my.cnf
- INITIAL LOGIN ATTEMPT FAILED -
-
Testing for stored webmin passwords:
-
None Found
-
Could not auto detect login info!
-
Found potential sockets: /tmp/mysql.sock
-
Using: /tmp/mysql.sock
-
Would you like to provide a different socket?: [y/N] n
-
Do you have your login handy ? [y/N] : y
-
User: root
-
Password: 123456
-
Would you like me to create a ~/.my.cnf file for you? [y/N] : n
- FINAL LOGIN ATTEMPT FAILED -
-
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;">
- mysqladmin="mysqladmin -S (cat /etc/psa/.psa.shadow)"
- 修改成
- mysqladmin="/usr/local/mysql/bin/mysqladmin -S (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;">
- mysqladmin="/usr/local/mysql/bin/mysqladmin"
- 修改成
- mysqladmin="mysqladmin"
</pre>
在执行tuning-primer.sh脚本的时候就没有问题了
生成的报告会有建议,根据自己的实际情况来修改
下面是我报告的截图,报告很长,可仔细看一下
网友评论