Tuesday, April 16, 2013

Mysql 5.1* installation

Check mysql is installed or not
rpm -qa | grep mysql
If mysql on the system
rpm -e mysql
Create a user mysql with group mysql
# groupadd -g 501 mysql
# useradd -u 501 -g 501 -G users -s /bin/bash -d /var/mysql -m mysql
Download Mysql source ball
# mkdir /var/mysql/src
# cd /var/mysql/src/
# wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.65.tar.gz
# chown -R mysql.mysql /var/mysql/src/


Compile mysql from tar ball
# su – mysql
$ cd src/
$ tar -zxvf mysql-5.1.65.tar.gz
$ cd mysql-5.1.65
$ ./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
Switch to root user and continue the installation
$ su – root
# make install
Setup MySQL configuration and startup files
# cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf
# chown mysql.mysql /etc/my.cnf
# chmod 600 /etc/my.cnf
# cp /usr/local/share/mysql/mysql.server /etc/init.d/mysqld
# chmod +x /etc/init.d/mysqld
# chkconfig –add mysqld
# chkconfig mysqld on
Edit my.cnf for modification
# vim /etc/my.cnf
uncomment the InnoDB tables
set ibdata1 to be of size 20M with autoextend
Export MySQL shared libraries
# vim /etc/ld.so.conf
add this /usr/local/lib/mysql
Save and exit the file and run the command
# ldconfig
Default database installation
# su mysql
$ mysql_install_db ->> make sure data directory is writable by mysql
$ su -
Start the Mysql server
# /etc/init.d/mysqld start
Set administrator password for mysql
# mysqladmin -u root password <password>
connect server using mysql client
# mysql -u root –p <password>

No comments:

Post a Comment