Debian 12
HestiaCP : v1.9.3
I’ve recently created 2 Debian 12 Servers and on both when I try to use commands mysql or related mysqldump, etc it says command not found.
I have to use mariadb or mariadb-dump commands explicitly. But this breaks alot of my legacy scripts, and even wp cli ‘db export’ commands too.
I guess it is related to some copyright and with Oracle MySQL… so can we not make the necessary alias in HestiaCP’s install script? We always used to have it… just notices in this particular version having problems.
But keep in mind that MariaDB is deprecating the use of these alias so you should update your scripts to use the MariaDB native commands. Indeed, when you use, for example, the mysql command, you will see this notice:
mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead
I know of that… and I’m aware of the deprecation too. Its just that for legacy commands… it will still take quite a few years as given the example of WP CLI. So it will be better to have an Alias written during the hestiaCP install
If you want compatibility, install the compat package. I don’t think Hestia should create links on its own to perpetuate the issue of scripts that never get updated unless someone forces them to. I can understand Hestia installing the compat package (as long as it still exists), but as I said, I don’t think Hestia should perpetuate the problem of third-party scripts.
Its something that has recently starting to enforce, plus all of maintaining server through terminal have the muscle memory of 20-30 may be more years to be using ‘mysql’ and ‘mysqldump’ commands. The seasoned admins might just get away making these symlinks but new adaptors will be reading plenty of documents and tutorials refering to these legacy commands and will surely get confused. I don’t think making 2 symlinks should be such an issue.
As I said, I don’t think Hestia should create those symlinks (but that’s only my opinion). Instead, it could install the compatibility packages (mariadb-client-compat and mariadb-server-compat). However, keep in mind that the deprecation message will still appear. To suppress it, you can set global aliases for those commands.
I was bored, so I created this script to add all of them:
#!/usr/bin/env bash
if [[ $EUID -ne 0 ]];then
echo "Script must be executed as root user" >&2
exit 1
fi
# MariaDB client aliases
declare -A a_alias_client
declare -a orderC
a_alias_client[mysql]="/usr/bin/mariadb" ; orderC+=("mysql")
a_alias_client[mysqlaccess]="/usr/bin/mariadb-access" ; orderC+=("mysqlaccess")
a_alias_client[mysqladmin]="/usr/bin/mariadb-admin" ; orderC+=("mysqladmin")
a_alias_client[mysqlanalyze]="/usr/bin/mariadb-check" ; orderC+=("mysqlanalyze")
a_alias_client[mysqlbinlog]="/usr/bin/mariadb-binlog" ; orderC+=("mysqlbinlog")
a_alias_client[mysqlcheck]="/usr/bin/mariadb-check" ; orderC+=("mysqlcheck")
a_alias_client[mysql_convert_table_format]="/usr/bin/mariadb-convert-table-format" ; orderC+=("mysql_convert_table_format")
a_alias_client[mysqldump]="/usr/bin/mariadb-dump" ; orderC+=("mysqldump")
a_alias_client[mysqldumpslow]="/usr/bin/mariadb-dumpslow" ; orderC+=("mysqldumpslow")
a_alias_client[mysql_find_rows]="/usr/bin/mariadb-find-rows" ; orderC+=("mysql_find_rows")
a_alias_client[mysql_fix_extensions]="/usr/bin/mariadb-fix-extensions" ; orderC+=("mysql_fix_extensions")
a_alias_client[mysqlhotcopy]="/usr/bin/mariadb-hotcopy" ; orderC+=("mysqlhotcopy")
a_alias_client[mysqlimport]="/usr/bin/mariadb-import" ; orderC+=("mysqlimport")
a_alias_client[mysqloptimize]="/usr/bin/mariadb-check" ; orderC+=("mysqloptimize")
a_alias_client[mysql_plugin]="/usr/bin/mariadb-plugin" ; orderC+=("mysql_plugin")
a_alias_client[mysqlrepair]="/usr/bin/mariadb-check" ; orderC+=("mysqlrepair")
a_alias_client[mysqlreport]="/usr/bin/mariadb-report" ; orderC+=("mysqlreport")
a_alias_client[mysql_secure_installation]="/usr/bin/mariadb-secure-installation" ; orderC+=("mysql_secure_installation")
a_alias_client[mysql_setpermission]="/usr/bin/mariadb-setpermission" ; orderC+=("mysql_setpermission")
a_alias_client[mysqlshow]="/usr/bin/mariadb-show" ; orderC+=("mysqlshow")
a_alias_client[mysqlslap]="/usr/bin/mariadb-slap" ; orderC+=("mysqlslap")
a_alias_client[mysql_tzinfo_to_sql]="/usr/bin/mariadb-tzinfo-to-sql" ; orderC+=("mysql_tzinfo_to_sql")
a_alias_client[mysql_waitpid]="/usr/bin/mariadb-waitpid" ; orderC+=("mysql_waitpid")
# MariaDB server aliases
declare -A a_alias_server
declare -a orderS
a_alias_server[mysqld]="/usr/sbin/mariadbd" ; orderS+=("mysqld")
a_alias_server[mysqld_multi]="/usr/bin/mariadbd-multi" ; orderS+=("mysqld_multi")
a_alias_server[mysqld_safe]="/usr/bin/mariadbd-safe" ; orderS+=("mysqld_safe")
a_alias_server[mysqld_safe_helper]="/usr/bin/mariadbd-safe-helper" ; orderS+=("mysqld_safe_helper")
a_alias_server[mysql_install_db]="/usr/bin/mariadb-install-db" ; orderS+=("mysql_install_db")
a_alias_server[mysql_upgrade]="/usr/bin/mariadb-upgrade" ; orderS+=("mysql_upgrade")
titleC="# MariaDB client aliases added by Hestia"
addTitleC=1
titleS="# MariaDB server aliases added by Hestia"
addTitleS=1
for conffile in /etc/profile /etc/profile.d/mariadb-aliases.sh /etc/bash.bashrc /etc/zsh/zshrc; do
echo "Adding aliases to $conffile"
if [[ ! -f "$conffile" ]]; then
if ! touch "$conffile" &>/dev/null; then
continue
fi
fi
for claveC in "${orderC[@]}"; do
if ! grep -q "alias $claveC=" "$conffile"; then
if [[ addTitleC -eq 1 ]]; then
echo "$titleC" >>"$conffile"
addTitleC=0
fi
echo "alias $claveC=\"${a_alias_client[$claveC]}\"" >>"$conffile"
else
echo "WARNING: alias $claveC already exists in $conffile"
fi
done
addTitleC=1
for claveS in "${orderS[@]}"; do
if ! grep -q "alias $claveS=" "$conffile"; then
if [[ addTitleS -eq 1 ]]; then
echo "$titleS" >>"$conffile"
addTitleS=0
fi
echo "alias $claveS=\"${a_alias_server[$claveS]}\"" >>"$conffile"
else
echo "WARNING: alias $claveS already exists in $conffile"
fi
done
addTitleS=1
if [[ ! -s "$conffile" ]]; then
rm -f "$conffile"
fi
done
But again, hiding the deprecation message should be avoided because it removes the incentive to fix those legacy scripts.
Note: I’m not a Hestia developer, just a user like you