Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Context Sensitive Group
freedombone
Commits
45be6e29
Commit
45be6e29
authored
7 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Tidying
parent
de8e808e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-utils-database
+22
-13
22 additions, 13 deletions
src/freedombone-utils-database
with
22 additions
and
13 deletions
src/freedombone-utils-database
+
22
−
13
View file @
45be6e29
...
...
@@ -144,6 +144,24 @@ function get_mariadb_password {
fi
}
function
mariadb_fix_authentication
{
# See http://www.pontikis.net/blog/debian-9-stretch-rc3-web-server-setup-php7-mariadb
# https://mariadb.com/kb/en/mariadb/unix_socket-authentication-plugin
function_check run_query
run_query_root mysql
"update mysql.user set plugin = '' where User='root'; flush privileges;"
run_query_root mysql
"UPDATE user SET Password=PASSWORD('
$MARIADB_PASSWORD
') where USER='root'; flush privileges;"
sed
-i
's| --skip-grant-tables||g'
/lib/systemd/system/mariadb.service
systemctl daemon-reload
systemctl restart mariadb
}
function
mariadb_create_root_user
{
run_query mysql
"CREATE USER 'root@localhost' IDENTIFIED BY '
${
MARIADB_PASSWORD
}
'; flush privileges;"
run_query mysql
"update mysql.user set plugin = '' where User='root@localhost'; flush privileges;"
run_query mysql
"GRANT ALL PRIVILEGES ON * TO 'root@localhost'; flush privileges;"
}
function
install_mariadb
{
if
[[
$(
is_completed
$FUNCNAME
)
==
"1"
]]
;
then
return
...
...
@@ -151,6 +169,8 @@ function install_mariadb {
apt-get
-yq
install
software-properties-common debconf-utils
apt-get
-yq
update
remove_watchdog_daemon mariadb
function_check get_mariadb_password
get_mariadb_password
if
[
!
$MARIADB_PASSWORD
]
;
then
...
...
@@ -185,24 +205,13 @@ function install_mariadb {
systemctl daemon-reload
systemctl restart mariadb
# See http://www.pontikis.net/blog/debian-9-stretch-rc3-web-server-setup-php7-mariadb
# https://mariadb.com/kb/en/mariadb/unix_socket-authentication-plugin
function_check run_query
run_query_root mysql
"update mysql.user set plugin = '' where User='root'; flush privileges;"
run_query_root mysql
"UPDATE user SET Password=PASSWORD('
$MARIADB_PASSWORD
') where USER='root'; flush privileges;"
sed
-i
's| --skip-grant-tables||g'
/lib/systemd/system/mariadb.service
systemctl daemon-reload
systemctl restart mariadb
mariadb_fix_authentication
# mariadb daemon seems to occasionally crash
# This is a crude attempt to keep it running
add_watchdog_daemon mariadb
run_query mysql
"CREATE USER 'root@localhost' IDENTIFIED BY '
${
MARIADB_PASSWORD
}
'; flush privileges;"
run_query mysql
"update mysql.user set plugin = '' where User='root@localhost'; flush privileges;"
run_query mysql
"GRANT ALL PRIVILEGES ON * TO 'root@localhost'; flush privileges;"
mariadb_create_root_user
mark_completed
$FUNCNAME
}
...
...
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