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
Merge requests
!14
Added code to the script 99-permitions.sh to identify if using MySQL or MariaDB
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Added code to the script 99-permitions.sh to identify if using MySQL or MariaDB
33-allow-using-mariadb-as-database-in-the-container
into
main
Overview
0
Commits
1
Changes
1
Merged
Rodrigo Gonçalves
requested to merge
33-allow-using-mariadb-as-database-in-the-container
into
main
7 months ago
Overview
0
Commits
1
Changes
1
Expand
Related to
#33 (closed)
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
0b865e49
1 commit,
7 months ago
1 file
+
23
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
docker/db/99-permitions.sh
+
23
−
6
Options
#!/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
Loading