Files
old-v2-backend/mysql_config.sh

16 lines
580 B
Bash
Raw Permalink Normal View History

2018-06-24 12:01:25 +02:00
#!/bin/bash
if [[ "$OSTYPE" == "darwin"* ]]; then
# If there's no password set for MySQL (first-time install), add one and cleanup
if mysql -uroot; then
mysql -uroot <<_EOF_
UPDATE mysql.user SET authentication_string=PASSWORD('root') WHERE User='root';
DELETE FROM mysql.user WHERE User='';
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
FLUSH PRIVILEGES;
_EOF_
fi
fi