mysql修改密码BASH脚本
- 2018-06-12 11:49:24
- 脚本
- 23
- shevechco
写下常用脚本,利用EOF子命令来执行后续命令,没事练练手
#!/bin/bash #author merci echo "Please input old password" read o echo "Please inpput new password" read n echo "Please inpput repassword" read r if [ $n != $r ]; then echo "Password Inconsistent !" exit 1 fi mysql -u root -p$o <<EOF use mysql; update user set password=password("$n") where user="root"; flush privileges; exit EOF
分解符EOF可以定义任何字符串,这个和php的定界符还是有一丢丢相似
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:http://www.sulao.cn/post/484