1 #!/bin/bash #开头必写 2 3 #数据库密码初始化 4 pwd="admin" 5 mysql -uroot <<EOF 6 use mysql; 7 UPDATE user SET password=password('${pwd}') WHERE user='root'; 8 flush privileges; 9 exit 10 EOF