Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using CentOS 5.5.

I installed the mysql-server RPM from I believe this RPM was supposed to create a user called 'mysql'. However, this user doesn't exist.

How can I view the contents of an RPM to see if it attempts to create a user or group?

share|improve this question
up vote 7 down vote accepted

To view scripts in a RPM run:

rpm -q --scripts $INSTALLEDPACKAGE

To answer your question: yes, mysql-server creates the mysql user.

[user@server CentOS]# rpm -qp --scripts mysql-server-5.0.77-4.el5_4.2.i386.rpm
warning: mysql-server-5.0.77-4.el5_4.2.i386.rpm: V3 DSA signature: NOKEY, key ID e8562897
preinstall scriptlet (using /bin/sh):
/usr/sbin/useradd -M -o -r -d /var/lib/mysql -s /bin/bash \
        -c "MySQL Server" -u 27 mysql > /dev/null 2>&1 || :
postinstall scriptlet (using /bin/sh):
if [ $1 = 1 ]; then
    /sbin/chkconfig --add mysqld
/bin/chmod 0755 /var/lib/mysql
/bin/touch /var/log/mysqld.log
preuninstall scriptlet (using /bin/sh):
if [ $1 = 0 ]; then
    /sbin/chkconfig --del mysqld
postuninstall scriptlet (using /bin/sh):
if [ $1 -ge 1 ]; then
    /sbin/service mysqld condrestart >/dev/null 2>&1 || :
share|improve this answer
Thanks. Bonus question: I don't see a line which modifies /etc/group . How can I tell what package added 'mysql' to /etc/group ? – Stefan Lasiewski Aug 4 '10 at 17:39
I'll answer my bonus question. If no group is specified, then useradd will create a group by default. From man useradd: "The version provided with Red Hat Linux will create a group for each user added to the system by default" – Stefan Lasiewski Aug 4 '10 at 17:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.