-
-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2196 from Fourdee/switch_to_mysql
DietPi-Services | MariaDB: Switch to "mariadb" systemd service on Stretch+
- Loading branch information
Showing
6 changed files
with
47 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,19 +7,19 @@ | |
# Created by Daniel Knight / [email protected] / dietpi.com | ||
#//////////////////////////////////// | ||
# Usage: | ||
# - /DietPi/dietpi/func/create_mysql_db DATABASE_NAME DATABASE_USER DATABASE_PW | ||
# - /DietPi/dietpi/func/create_mysql_db <DATABASE_NAME> <DATABASE_USER> <DATABASE_PW> | ||
# | ||
# Drop database: | ||
# - mysqladmin -uroot drop phpbb3 -f | ||
# - mysqladmin drop phpbb3 -f | ||
#//////////////////////////////////// | ||
|
||
DATABASE_NAME="$1" | ||
DATABASE_USER="$2" | ||
DATABASE_PW="$3" | ||
#Import DietPi-Globals --------------------------------------------------------------- | ||
. /DietPi/dietpi/func/dietpi-globals | ||
G_CHECK_ROOT_USER | ||
G_PROGRAM_NAME='DietPi-Create_MySQL_DB' | ||
G_CHECK_ROOT_USER | ||
G_INIT | ||
#Import DietPi-Globals --------------------------------------------------------------- | ||
|
||
|
@@ -28,12 +28,12 @@ | |
#///////////////////////////////////////////////////////////////////////////////////// | ||
|
||
#Start MySQL if not running. | ||
systemctl start mysql &> /dev/null | ||
(( G_DISTRO < 4 )) && systemctl start mysql &> /dev/null || systemctl start mariadb &> /dev/null | ||
|
||
G_DIETPI-NOTIFY 2 "Creating MariaDB database: $DATABASE_NAME" | ||
|
||
#Generate DB | ||
# 'identified by' can overwrite unix_socket authentication, thus just use this for non-root users. | ||
# 'identified by' can overwrite unix_socket authentication, thus use this for non-root users only. | ||
grant_privileges='' | ||
[[ $DATABASE_USER == root ]] || grant_privileges="grant all privileges on \`$DATABASE_NAME\`.* to $DATABASE_USER@localhost identified by '$DATABASE_PW';flush privileges" | ||
mysql -e "create database \`$DATABASE_NAME\`;$grant_privileges" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters