Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
IoT Platform
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IoT
IoT Platform
Commits
0b865e49
Commit
0b865e49
authored
7 months ago
by
Rodrigo Goncalves
Browse files
Options
Downloads
Patches
Plain Diff
Added code to the script 99-permitions.sh to identify if using MySQL or MariaDB
parent
724eca71
Branches
33-allow-using-mariadb-as-database-in-the-container
Branches containing commit
No related tags found
1 merge request
!14
Added code to the script 99-permitions.sh to identify if using MySQL or MariaDB
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docker/db/99-permitions.sh
+23
-6
23 additions, 6 deletions
docker/db/99-permitions.sh
with
23 additions
and
6 deletions
docker/db/99-permitions.sh
+
23
−
6
View file @
0b865e49
#!/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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment