#
# Copy createdb.sql.example to createdb.sql
# then uncomment then set database name and username to create you need databases
#
# example: .env MYSQL_USER=appuser and needed db name is myshop_db
#
#    CREATE DATABASE IF NOT EXISTS `myshop_db` ;
#    GRANT ALL ON `myshop_db`.* TO 'appuser'@'%' ;
#
#
# this sql script will auto run when the mysql container starts and the $DATA_PATH_HOST/mysql not found.
#
# if your $DATA_PATH_HOST/mysql exists and you do not want to delete it, you can run by manual execution:
#
#     docker-compose exec mysql bash
#     mysql -u root -p < /docker-entrypoint-initdb.d/createdb.sql
#
CREATE USER 'gwmarket'@'%' IDENTIFIED BY 'r31TEh2XJ4MTZt8wR74k96gQ';
CREATE USER 'tyug'@'%' IDENTIFIED BY 'x0kSHKGykxSyB5s32kWOsqu7';

CREATE DATABASE IF NOT EXISTS `gwmarket` COLLATE 'utf8_general_ci' ;
GRANT ALL ON `gwmarket`.* TO 'gwmarket'@'%' ;

CREATE DATABASE IF NOT EXISTS `tyug` COLLATE 'utf8_general_ci' ;
GRANT ALL ON `tyug`.* TO 'tyug'@'%' ;

#CREATE DATABASE IF NOT EXISTS `dev_db_3` COLLATE 'utf8_general_ci' ;
#GRANT ALL ON `dev_db_3`.* TO 'default'@'%' ;

FLUSH PRIVILEGES ;
