mirror of
https://fast.feibisi.com/https://github.com/wp-cli/scaffold-command.git
synced 2025-10-03 16:51:08 +08:00
Add missing creds
Added the missing credentials in the mysql call. Also changed the prompt in the drop db confirm to be something people are more used to seeing. Added an else case to handle instances in which the database doesn’t exists.
This commit is contained in:
parent
9fbaab9c9b
commit
2b4a9bdbea
1 changed files with 4 additions and 2 deletions
|
@ -147,10 +147,10 @@ install_db() {
|
|||
fi
|
||||
|
||||
# create database
|
||||
if [ $(mysql -e 'show databases;' | grep ^$DB_NAME$) ]
|
||||
if [ $(mysql -e --user="$DB_USER" --password="$DB_PASS" 'show databases;' | grep ^$DB_NAME$) ]
|
||||
then
|
||||
echo "Reinstalling will delete the existing test database ($DB_NAME)"
|
||||
read -p 'Are you sure you want to proceed? [No/Yes]: ' DELETE_EXISTING_DB
|
||||
read -p 'Are you sure you want to proceed? [y/N]: ' DELETE_EXISTING_DB
|
||||
shopt -s nocasematch
|
||||
if [[ $DELETE_EXISTING_DB =~ ^(y|yes)$ ]]
|
||||
then
|
||||
|
@ -160,6 +160,8 @@ install_db() {
|
|||
echo "Leaving the existing database ($DB_NAME) in place."
|
||||
fi
|
||||
shopt -u nocasematch
|
||||
else
|
||||
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue