Skip to content

Commit

Permalink
mysql
Browse files Browse the repository at this point in the history
MySQL Client not creating CNF files by default in some cases.
  • Loading branch information
QROkes committed Nov 26, 2024
1 parent 4ce833d commit 6198611
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
26 changes: 22 additions & 4 deletions lib/install
Original file line number Diff line number Diff line change
Expand Up @@ -1161,10 +1161,28 @@ stack_builder() {
if [[ $3 == "mysql-client" && $(conf_read mysql-client) != "true" ]]; then
mysql_client_install
# MySQL-Client: MariaDB creates /etc/mysql folder automatically when client only, MySQL NOT!
if [[ $(conf_read db-engine) == "mysql" && ! -d /etc/mysql/mysql.conf.d ]]; then
mkdir -p /etc/mysql/mysql.conf.d
sudo find /etc/mysql -type d -exec chmod 755 {} \;
fi
# MySQL-Client: MariaDB doesn't create default CNF (sometimes) when reinstalling client alone. I don't know why!
[[ $(conf_read db-engine) == "mysql" && ! -d /etc/mysql/mysql.conf.d ]] && mkdir -p /etc/mysql/mysql.conf.d
[[ $(conf_read db-engine) != "mysql" && ! -d /etc/mysql/mariadb.conf.d ]] && mkdir -p /etc/mysql/mariadb.conf.d
[[ ! -d /etc/mysql/conf.d ]] && mkdir -p /etc/mysql/conf.d

# We need to force our own CNF
# These files are very inconcistent, especially for MySQL
# Sometimes are not created, sometimes 'mysql.conf.d' folder is not included, etc...
# Seems like it only happens with mysql-client alone, mysql-server seems to be fine!
rm -rf /etc/mysql/my.cnf
touch /etc/mysql/my.cnf
echo "[client-server]
# Port or socket location where to connect
# port = 3306
socket = /run/mysqld/mysqld.sock
# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/" >> /etc/mysql/my.cnf

[[ $(conf_read db-engine) == "mysql" ]] && sed -i 's/mariadb/mysql/g' /etc/mysql/my.cnf
sudo find /etc/mysql -type d -exec chmod 755 {} \;
fi

[[ $3 == "mysql" && $(conf_read mysql) != "true" ]] && mysql_client_install && mysql_install && local mysql_pass_display="true" && mysql_optim
Expand Down
2 changes: 1 addition & 1 deletion usr/stack
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ elif [[ -n $purge && -n $mysql ]]; then
else
echo "mysql-community-server mysql-community-server/remove-data-dir boolean true" | debconf-set-selections
fi
sudo apt -y purge mysql-server mysql-common mysql-common
sudo apt -y purge mysql-server mysql-common
else
mysqlver=$(conf_read mysql-ver)
# In 10.11 debconf variables changed!
Expand Down

0 comments on commit 6198611

Please sign in to comment.