在脚本里面执行到mysqladmin时报错
pass=grep "temporary password" /opt/mydata/log/error.log |awk -F " " '{print $11}'
echo "temporary password - $pass"
/usr/local/mysql/bin/mysqladmin -uroot -p$pass password 'root'
报错的内容如下
temporary password - *aXeNARs&3?O
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/opt/mydata/data/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/opt/mydata/data/mysql.sock' exists!
我把mysqladmin单独执行或者是移到另外的脚本里都没有问题,具体脚本内容和my.cnf太多,我放在博客里https://www.cnblogs.com/ddzj01/p/10676769.html,盼望能得到大家的回复。