bash检查MySQL是否连接成功

直接上代码:

until mysql -h"127.0.0.1" -u"root" -p"123456" -P"3306" -e ";"; do
   &2 echo "MySQL is unavailable - sleeping"
     sleep 1
   done
   &2 echo "MySQL is up - executing command" 

发表评论

电子邮件地址不会被公开。 必填项已用*标注

昵称 *