Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Timothy Frew
Sympl
Commits
45e0913d
Commit
45e0913d
authored
Jul 23, 2018
by
Andrew Ladlow
Browse files
mysql: Handle case where .mysql.hash doesn't exist
parent
1a7e8bb6
Changes
1
Hide whitespace changes
Inline
Side-by-side
mysql/debian/postinst
View file @
45e0913d
...
...
@@ -45,9 +45,12 @@ fi
# Add an admin user with user/password authentication for phpmyadmin if one doesn't already exist
#
if
grep
-qx
'password = '
/etc/mysql/debian.cnf
&&
[
"
$(
mysql
-u
root
-se
"select exists(select user from mysql.user where user = 'admin');"
)
"
=
"0"
]
;
then
echo
"I: Adding 'admin'@'localhost' MySQL user"
if
[
-e
/etc/first-boot.d/.mysql.hash
]
;
then
echo
"I: Adding 'admin'@'localhost' MySQL user"
mysql
-u
root
-e
"grant all privileges on *.* to 'admin'@'localhost' identified by password '*
$(
cat
/etc/first-boot.d/.mysql.hash
)
' with grant option;"
else
read
-p
"Enter password for admin@localhost MySQL user: "
password
mysql
-u
root
-e
"grant all privileges on *.* to 'admin'@'localhost' identified by '
$password
' with grant option;"
fi
fi
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment