1

Topic: FATAL ERROR: Upgrade failed When MySQL Starts

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.3.2
- Deployed with iRedMail Easy or the downloadable installer? Downloadable Installer
- Linux/BSD distribution name and version: Ubuntu 20.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx):Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Using systemctl status mysql I noticed the following errors:

: 2021-03-23 19:27:04 0 [Note] /usr/sbin/mysqld (mysqld 10.3.25-MariaDB-0ubuntu0.20.04.1) starting as process 792 ...
systemd[1]: Started MariaDB 10.3.25 database server.
/etc/mysql/debian-start[935]: Upgrading MySQL tables if necessary.
/etc/mysql/debian-start[940]: Looking for 'mysql' as: /usr/bin/mysql
/etc/mysql/debian-start[940]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
/etc/mysql/debian-start[940]: Version check failed. Got the following error when calling the 'mysql' command line client
/etc/mysql/debian-start[940]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
/etc/mysql/debian-start[940]: FATAL ERROR: Upgrade failed
/etc/mysql/debian-start[981]: Checking for insecure root accounts.
debian-start[984]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

But using mysqlcheck -u root --all-databases from the command prompt works as expected. I assume the root password is being retrieved from /root/.my.cnf.

However, /etc/mysql/debian-start uses /etc/mysql/debian.cnf as the defaults file, but /etc/mysql/debian.cnf doesn't contain the root password. If I add the root password to /etc/mysql/debian.cnf and restart mysql it works and I get:

/etc/mysql/debian-start[3102]: vmail.recipient_bcc_domain                         OK
/etc/mysql/debian-start[3102]: vmail.recipient_bcc_user                           OK
/etc/mysql/debian-start[3102]: vmail.sender_bcc_domain                            OK
/etc/mysql/debian-start[3102]: vmail.sender_bcc_user                              OK
/etc/mysql/debian-start[3102]: vmail.sender_relayhost                             OK
/etc/mysql/debian-start[3102]: vmail.share_folder                                 OK
/etc/mysql/debian-start[3102]: vmail.used_quota                                   OK
/etc/mysql/debian-start[3102]: Phase 7/7: Running 'FLUSH PRIVILEGES'
/etc/mysql/debian-start[3102]: OK
/etc/mysql/debian-start[3139]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables

My question is, is it OK to have the root password in /etc/mysql/debian.cnf or should I change references to /etc/mysql/debian.cnf in the file /etc/mysql/debian-start to point to /root/.my.cnf instead which already contains the root password?

Thanks, Steve.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: FATAL ERROR: Upgrade failed When MySQL Starts

I am having the exact same problems to the tee, with the exact same OS, and setup, and I found the exact same solution, and I ALSO HAVE THE EXACT SAME QUESTION!

The fact that this error occurs from a fresh install of iRed, doesnt smell right. As far as I can remember with my minimal work with webservers, you are never supposed to put your root password into a plain text file on any machine. So this worries me quite a bit, and i am looking for some sort of workaround that is secure and doesnt require me to put my root password in plain text.

THIS SEEMS LIKE A MAJOR ISSUE SINCE IT OCCURS AFTER EVERY DEFAULT INSTALL!
Any help anyone?

3

Re: FATAL ERROR: Upgrade failed When MySQL Starts

Run  this SQL command as mysql root user should fix the issue:

USE mysql;
UPDATE user SET plugin='unix_socket' WHERE User='root';

4

Re: FATAL ERROR: Upgrade failed When MySQL Starts

MariaDB [(none)]> USE mysql;
Database changed
MariaDB [(none)]> UPDATE user SET plugin='unix_socket'WHERE User='root';
Ignoring query to other database