Initialize MySQL if the data directory is missing

This commit is contained in:
coolneng 2021-01-08 01:22:02 +01:00
parent 5ace56e9d8
commit 834a6abdc8
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 5 additions and 2 deletions

7
env/mysql.nix vendored
View File

@ -12,9 +12,12 @@ in mkShell {
shellHook = ''
trap "kill 0" EXIT
[ -d ${data_dir} ] || mkdir ${data_dir}
mysqld --datadir="${data_dir}" --socket="${socket}" --initialize-insecure
if [ ! -d ${data_dir} ]; then
mysqld --datadir="${data_dir}" --socket="${socket}" --initialize-insecure
fi
mysqld --datadir="${data_dir}" --socket="${socket}" --skip-networking --skip-mysqlx &
sleep 1