Bug #12556 upgrading to 4.0.25 removed mysql user and stops server
Submitted: 12 Aug 2005 18:04 Modified: 9 Sep 2005 0:44
Reporter: Andrew Ircha Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.25 OS:Linux (Linux FC3)
Assigned to: CPU Architecture:Any

[12 Aug 2005 18:04] Andrew Ircha
Description:
I tried to upgrade from 3.23 to 4.0.25. The existing server was working ok, with database files owned by the mysql user in the mysql group.

rpm installation appeared to be fine, but the server would not start. It looked like the installation process had specifically removed the mysql user, which is required to write the pid file in /var/lib/mysql and access the database tables.

I was able to restore the mysql user by restoring the password files in /etc.

/etc/passwd backed up to /etc/passwd-
/etc/group backed up to /etc/group-
/etc/gshadow backed up to /etc/gshadow-
/etc/shadow backed up to /etc/shadow-

How to repeat:
Download a collection of rpms from mysql.com and attempt to install using:

rpm -Uvh MySQL-client-4.0.25-0.i386.rpm
rpm -Uvh MySQL-devel-4.0.25-0.i386.rpm
rpm -Uvh MySQL-server-4.0.25-0.i386.rpm
rpm -Uvh MySQL-shared-4.0.25-0.i386.rpm
rpm -Uvh MySQL-shared-compat-4.0.25-0.i386.rpm

(or you might use the easier rpm -Uvh MySQL*.rpm in the correct directory)

I then tried to start the server with:

service mysql restart

It's only when I tried to log in with:
mysql -u root -p

That I get an error that the pid file is missing.

I noticed that the mysql user had disappeared from the system. I also noticed the user files in etc had been backed up.

Suggested fix:
I don't think I would recommend it, but I was able to get the server running again by restoring the mysql user with the following move (mv) commands. This method preserves the uid/gid settings used by the deleted mysql.mysql user:

mv /etc/passwd- /etc/passwd
mv /etc/shadow- /etc/shadow
mv /etc/group- /etc/groupd
mv /etc/gshadow- /etc/gshadow

My suggestion is to fix the routine which manipulates the user files.
[9 Sep 2005 0:44] MySQL Verification Team
I was unable to repeat the issue reported on Fedora Core 4. I installed
3.23.58 and upgrade to 4.0.26 without to touch the mysql user.

 [miguel@hegel ~]$ mysql -umysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 3.23.58

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select user();
+-----------------+
| user()          |
+-----------------+
| mysql@localhost |
+-----------------+
1 row in set (0.00 sec)

mysql> exit
Bye
[miguel@hegel ~]$ uname -a
Linux hegel 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 athlon i386 GNU/Linux

[miguel@hegel ~]$ mysql -umysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.26-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select User();
+-----------------+
| User()          |
+-----------------+
| mysql@localhost |
+-----------------+
1 row in set (0.00 sec)