蒙国造博客

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" 
退出移动版