mysql优化脚本工具tuning-primer.sh安装使用及错误解决办法
一,下载以及使用
1,wget http://www.day32.com/MySQL/tuning-primer.sh
2,将tuning-primer.sh拷贝到my.cnf的同级目录
3,sh tuning-primer.sh 或者chmod +x tuning-primer.sh 然后在 ./tuning-primer.sh 二者没什么区别
[root@BlackGhost mysql]# sh tuning-primer.sh
Using login values from ~/.my.cnf
– INITIAL LOGIN ATTEMPT FAILED –
Testing for stored webmin passwords:
None Found
Could not auto detect login info!
Found Sockets: /tmp/mysql.sock //找到一个mysql.sock
Using: /tmp/mysql.sock //使用这个.sock文件
Would you like to provide a different socket?: [y/N] n //是否使用其他的socket
Do you have your login handy ? [y/N] : y //是否手动输入用户名和密码,当然你可以在my.cnf里面设置
User: root
Password:
Would you like me to create a ~/.my.cnf file for you? [y/N] : n //是不是要帮你在创建一个my.cnf
你也可以把用户名和密码放到my.cnf里面,如下
[client]
user = 用户名
password = 密码
socket = /tmp/mysql.sock
出现错误解决办法:
错误1. Error: Command line calculator ‘bc’ not found!
解决方法:If you don’t know bc is (which I didn’t) it is the command line arbitrary precision calculator from GNU and it is obviously used within the shell script we are trying to run.
Therefore you will need to install this as well by using apt-get. So run this:
apt-get install bc
Which will install the bc app.
错误2. Unable to log into socket: /tmp/mysql.sock
解决方法:经查代码, 原来是MYSQLADMIN没有加入Path导致的,做完软链接,再次执行即可。
# ln -s /usr/local/mysql/bin/mysqladmin /usr/bin/mysqladmin
二,运行结果,以及部分分析和建议
根据红字部分和黄字部分的建议更改my.inin或者my.cnf即可。
近期评论