...
elif [ -n "$(which mysql 2> /dev/null)" ]; then
if [ "${DB_PORT}x" == "x" ]; then
DB_PORT="3306"
fi
mysqladmin status -h $DB_HOST -P $DB_PORT
state=$?
fi
# Check error state to ensure database is online
if [[ $state -gt 0 ]]; then
echo "!!! ERROR !!!"
echo "Your database does not seem to be online!"
echo "Please check your configuration in config/database.yml and ensure the configured database server is online."
echo "Exiting Zammad package installation / upgrade - try again."
exit 1
fi
...
The bug/issue seems to be caused by the fact that following call succeeds:
# mysqladmin status -h localhost
Uptime: 2603 Threads: 36 Questions: 209452 Slow queries: 0 Opens: 170 Open tables: 163 Queries per second avg: 80.465
But the one with port specified (as in preinst script) fails:
# mysqladmin status -h localhost -P 3306
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost''
I’ve confirmed that the server is listening at 127.0.0.1:3306 and localhost resolves to 127.0.0.1, but database credentials do not allow mysqladmin root connection from network interface (default debian configuration).
There should not be any difference between calling mysqladmin with -P 3306 and without it but there is.
Maybe preinst script could take this difference in account and bypass the port parameter if it matches the default value of 3306?
MySQL user db lists ‘root@localhost’ (checked that!):
]> SELECT user,host FROM mysql.user;
+-------------+-----------+
| User | Host |
+-------------+-----------+
| zammad | % |
| mariadb.sys | localhost |
| mysql | localhost |
| root | localhost |
+-------------+-----------+
4 rows in set (0.002 sec)
(MySQL scope)
As Zammad supports external databases, the port technically is required because admins may use different ports. That’s the reason it’s in the script.
Using the credentials from the OS most often does not work because most users don’t have that in scope and may not adjust the configuration accordingly. With this we’d rely on something potentially non functional. The aim for this change was to help admins not nuke them (we’ll I managed that any way…)
for me?
Adjust -u and -p with your database credentials and remove them from the command before posting them here please. As we’re checking the error code the echo is relevant for me as well. I’m on vacation so if you could help me with that cross check it would be a huge help for me to get this sorted out asap in a functional way.
I have to add that this is contrary to the mysqladmin docs:
-p, --password[=name]
Password to use when connecting to server. If password is
not given it's asked from the tty.
Not directly related to this, but no matter what I try, I cant get mysqladmin to accept password from command line parameters. It always falls back to tty prompting.
Not only with the -P parameter for port, but with this, mysqladmin is does not seem to work consistently and match the behaviour of other CLI tools with similar parameters.
# mysqladmin --version
mysqladmin Ver 9.1 Distrib 10.6.15-MariaDB, for debian-linux-gnu on x86_64
Confirmed similar behaviour with next MariaDB LTS version 10.11:
# mysqladmin --version
mysqladmin Ver 9.1 Distrib 10.11.5-MariaDB, for debian-linux-gnu on x86_64
This means that authentication with -h localhost -P 3306 differs from -h localhost even when default port is in use and -p / --password never accepts cmdline argument as value; password is instead incorrectly passed as command.
For me, in two Zammad installations, preinst check works if -P 3306 is omitted when defaut MySQL port is used by the server. Plain -h localhost works, -h localhost -P 3306 does not work. There is no obvious reason for this as database has user credentials for root@localhost and zammad@% - looks more like bug than mismatched credentials.
Passing custom user with -u works, but -p does not work as documented for command line supplied passwords.
I do not run Zammad db in non-standard port so I have not tested that scenario.
I am as well trying to upgrade from 6.0 to 6.1 i have installed redis and updated all system packages before zammad upgrade , Now i am stuck with more than 2 hours with the below progress
The following packages will be upgraded:
zammad
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 141 MB of archives.
After this operation, 2,495 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://dl.packager.io/srv/deb/zammad/zammad/stable/ubuntu 18.04/main amd64 zammad amd64 6.1.0-1695897125.3f8a4154.bionic [141 MB]
Fetched 141 MB in 27min 20s (85.8 kB/s)
(Reading database … 710276 files and directories currently installed.)
Preparing to unpack …/zammad_6.1.0-1695897125.3f8a4154.bionic_amd64.deb …
Unpacking zammad (6.1.0-1695897125.3f8a4154.bionic) over (6.0.0-1694581997.6c378be7.bionic) …
Setting up zammad (6.1.0-1695897125.3f8a4154.bionic) …
Enforcing Redis…
Creating Redis bootstart
Synchronizing state of redis-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable redis-server