directus db 4

This commit is contained in:
Valentin 2024-02-23 18:10:27 +01:00
parent 363db01044
commit d083448cc9
1 changed files with 14 additions and 12 deletions

View File

@ -132,7 +132,6 @@ if [[ "$answer" == "y" ]]; then
expect eof expect eof
") ")
echo "${SECURE_MYSQL}" echo "${SECURE_MYSQL}"
apt -y purge expect
# https://gist.github.com/coderua/5592d95970038944d099 # https://gist.github.com/coderua/5592d95970038944d099
fi fi
@ -153,17 +152,20 @@ if [[ "$answer" == "y" ]]; then
echo echo
fi fi
install_expect install_expect
spawn mariadb -u root -p CREATE_DIRECTUS_DB=$(expect -c "
expect "Enter password:" spawn mariadb -u root -p
send "$db_root_password\r" expect \"Enter password:\"
expect "mysql>" send \"$db_root_password\r\"
send "CREATE USER 'directus'@'localhost' IDENTIFIED BY '${db_directus_password}';\r" expect \"mysql>\"
send "CREATE DATABASE directus;\r" send \"CREATE USER 'directus'@'localhost' IDENTIFIED BY '${db_directus_password}';\r\"
send "GRANT ALL PRIVILEGES ON directus.* TO 'directus'@'localhost' IDENTIFIED BY '${db_directus_password}';\r" send \"CREATE DATABASE directus;\r\"
send "FLUSH PRIVILEGES;\r" send \"GRANT ALL PRIVILEGES ON directus.* TO 'directus'@'localhost' IDENTIFIED BY '${db_directus_password}';\r\"
expect "mysql>" send \"FLUSH PRIVILEGES;\r\"
send "exit\r" expect \"mysql>\"
wait send \"exit\r\"
wait
")
echo "${CREATE_DIRECTUS_DB}"
fi fi