MYSQL INSTALLATION
# Create mysql group and user with a particular gid and uid.
/usr/sbin/groupadd -g 525 mysql
/usr/sbin/useradd -u 525 -g 525 -s /bin/bash -d /opt/mysql mysql
# Download mysql source.
cd /opt/src
wget http://www.percona.com/mysql/community/mysql-5.1.42.tar.gz
# Copy source file to mysql home directory.
cp /opt/src/mysql-5.1.42.tar.gz /opt/mysql
/bin/chown -R mysql.mysql /opt/mysql
/bin/chmod 755 /opt/mysql
# Switch to mysql user.
su - mysql
cd /opt/mysql
# Extract the source file.
tar -zxvf /opt/mysql/mysql-5.1.42.tar.gz
cd mysql-5.1.42
# Configure mysql.
./configure --prefix=/usr/local/ --enable-thread-safe-client --with-
unix-socket-path=/var/tmp/unix.sock --with-tcp-port=3306 --with-
mysqld-user=mysql --with-openssl --with-innodb --with-docs --enable-
static --localstatedir=/var/mysql/data
# Make
/usr/bin/make
# Now as root user.
cd /opt/mysql/mysql-5.1.42
/usr/bin/make install
# Copy mysql configuration file to '/etc/my.cnf'.
cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf
# Uncomment innodb lines in the conf file.
/bin/sed -ie 's/#innodb/innodb/g' /etc/my.cnf
/bin/chown mysql.mysql /etc/my.cnf
/bin/chmod 600 /etc/my.cnf
# Copy the startup script to /etc/init.d/mysqld.
cp /usr/local/share/mysql/mysql.server /etc/init.d/mysqld
/bin/chmod 744 /etc/init.d/mysqld
# Add the lib files path to /etc/ld.so.conf.
/bin/echo /usr/local/lib/mysql/ >> /etc/ld.so.conf
/sbin/ldconfig
/sbin/chkconfig --add mysqld
/sbin/chkconfig mysqld on
# Create the mysql data directory.
/bin/mkdir /var/mysql
/bin/chown -R mysql.mysql /var/mysql
# As mysql user create initial databases.
su - mysql
/usr/local/bin/mysql_install_db
# Now as root start mysql daemon.
/sbin/service mysqld start
# Set a password for root user if required.
/usr/local/bin/mysqladmin -u root password 'passpass'
# Create mysql group and user with a particular gid and uid.
/usr/sbin/groupadd -g 525 mysql
/usr/sbin/useradd -u 525 -g 525 -s /bin/bash -d /opt/mysql mysql
# Download mysql source.
cd /opt/src
wget http://www.percona.com/mysql/community/mysql-5.1.42.tar.gz
# Copy source file to mysql home directory.
cp /opt/src/mysql-5.1.42.tar.gz /opt/mysql
/bin/chown -R mysql.mysql /opt/mysql
/bin/chmod 755 /opt/mysql
# Switch to mysql user.
su - mysql
cd /opt/mysql
# Extract the source file.
tar -zxvf /opt/mysql/mysql-5.1.42.tar.gz
cd mysql-5.1.42
# Configure mysql.
./configure --prefix=/usr/local/ --enable-thread-safe-client --with-
unix-socket-path=/var/tmp/unix.sock --with-tcp-port=3306 --with-
mysqld-user=mysql --with-openssl --with-innodb --with-docs --enable-
static --localstatedir=/var/mysql/data
# Make
/usr/bin/make
# Now as root user.
cd /opt/mysql/mysql-5.1.42
/usr/bin/make install
# Copy mysql configuration file to '/etc/my.cnf'.
cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf
# Uncomment innodb lines in the conf file.
/bin/sed -ie 's/#innodb/innodb/g' /etc/my.cnf
/bin/chown mysql.mysql /etc/my.cnf
/bin/chmod 600 /etc/my.cnf
# Copy the startup script to /etc/init.d/mysqld.
cp /usr/local/share/mysql/mysql.server /etc/init.d/mysqld
/bin/chmod 744 /etc/init.d/mysqld
# Add the lib files path to /etc/ld.so.conf.
/bin/echo /usr/local/lib/mysql/ >> /etc/ld.so.conf
/sbin/ldconfig
/sbin/chkconfig --add mysqld
/sbin/chkconfig mysqld on
# Create the mysql data directory.
/bin/mkdir /var/mysql
/bin/chown -R mysql.mysql /var/mysql
# As mysql user create initial databases.
su - mysql
/usr/local/bin/mysql_install_db
# Now as root start mysql daemon.
/sbin/service mysqld start
# Set a password for root user if required.
/usr/local/bin/mysqladmin -u root password 'passpass'