Skip to content
Snippets Groups Projects
Commit ce7959c3 authored by Guilherme Arthur Gerônimo's avatar Guilherme Arthur Gerônimo
Browse files

Merge branch '33-allow-using-mariadb-as-database-in-the-container' into 'main'

Added code to the script 99-permitions.sh to identify if using MySQL or MariaDB

See merge request !14
parents d2aaee51 0b865e49
No related branches found
No related tags found
1 merge request!14Added code to the script 99-permitions.sh to identify if using MySQL or MariaDB
#!/bin/bash
MRP=$MYSQL_ROOT_PASSWORD
echo "CREATE USER IF NOT EXISTS 'smartdata_admin' IDENTIFIED BY '$MYSQL_PASSWORD';" | mysql -u root --password=$MRP
echo "CREATE USER IF NOT EXISTS 'smartdata' IDENTIFIED BY '$MYSQL_PASSWORD';" | mysql -u root --password=$MRP
echo "CREATE USER IF NOT EXISTS 'tutorial' IDENTIFIED BY '$MYSQL_PASSWORD';" | mysql -u root --password=$MRP
echo "GRANT ALL PRIVILEGES ON *.* TO 'smartdata_admin';" | mysql -u root --password=$MRP
echo "GRANT ALL PRIVILEGES ON *.* TO 'smartdata';" | mysql -u root --password=$MRP
echo "GRANT ALL PRIVILEGES ON *.* TO 'tutorial';" | mysql -u root --password=$MRP
# Initialize variable
db_command_path=""
# Check for mariadb command
if command -v mariadb &> /dev/null
then
db_command_path=$(command -v mariadb)
elif command -v mysql &> /dev/null
then
# Check for mysql command
db_command_path=$(command -v mysql)
else
echo "Neither mariadb nor mysql command found."
exit 1
fi
echo "CREATE USER IF NOT EXISTS 'smartdata_admin' IDENTIFIED BY '$MYSQL_PASSWORD';" | $db_command_path -u root --password=$MRP
echo "CREATE USER IF NOT EXISTS 'smartdata' IDENTIFIED BY '$MYSQL_PASSWORD';" | $db_command_path -u root --password=$MRP
echo "CREATE USER IF NOT EXISTS 'tutorial' IDENTIFIED BY '$MYSQL_PASSWORD';" | $db_command_path -u root --password=$MRP
echo "GRANT ALL PRIVILEGES ON *.* TO 'smartdata_admin';" | $db_command_path -u root --password=$MRP
echo "GRANT ALL PRIVILEGES ON *.* TO 'smartdata';" | $db_command_path -u root --password=$MRP
echo "GRANT ALL PRIVILEGES ON *.* TO 'tutorial';" | $db_command_path -u root --password=$MRP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment