« Disable recursive name resolutionIncrease Max Process Memory Allocation »

MySQL 4.1.13 Binary Install To RHEL 3 Taroon

08/27/05

Permalink 07:21:32 am, by admin Email , 631 words   English (US)
Categories: MySQL

MySQL 4.1.13 Binary Install To RHEL 3 Taroon

Recent I had to install MySQL on a RHEL 3 server. Normally I'd do this with RPMs but in this case the client needed an install that exactly matched another server which had been installed using the TAR/GZ binary distribution.

Here are the steps used for the install:

1. Download the binary TAR/GZ distribution. In this case it was named mysql-standard-4.1.13-pc-linux-gnu-i686.tar.gz and I downloaded it to /root/archive.

2. Unpack the distribution.

cd /root/archive
tar -xvzf mysql-standard-4.1.13-pc-linux-gnu-i686.tar.gz

3. The steps provided in the INSTALL-BINARY text file included in the distribution outline the following steps:


shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /PATH/TO/MYSQL-VERSION-OS.tar.gz | tar xvf -
shell> ln -s FULL-PATH-TO-MYSQL-VERSION-OS mysql
shell> cd mysql
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &

Taking these one at a time:

shell> groupadd mysql

Skip this step. The mysql group already exists so there is no need to add it.

shell> useradd -g mysql mysql

Skip this step. The mysql user already exists so there is no need to add it.


shell> cd /usr/local
shell> gunzip < /root/archive/mysql-standard-4.1.13-pc-linux-gnu-i686.tar.gz | tar xvf -
shell> ln -s mysql-standard-4.1.13-pc-linux-gnu-i686 mysql

Complete this steps as provided.


shell> cd mysql
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> chgrp -R mysql .

Complete these steps as provided.

shell> bin/mysqld_safe --user=mysql &

We'll skip this step for now since we need to setup an init script for the server.

That's it for the basic install. Now we need to:

1. Setup an init script and set the mysql server to start on boot.
2. Setup the my.cnf file.
3. Start the mysql server and set initial passwords.
4. Replace default mysql binary with a symlink to the new install.

Now one step at a time:

1. Setup an init script and set the mysql server to start on boot.

The mysql distribution includes a usable init script so we'll copy it into place:

cp support-files/mysql.server /etc/init.d/mysql

And then set the service to start on boot:

/sbin/chkconfig --add mysql

Now verify that the service will start at runlevels 2 to 5:

/sbin/chkconfig --list mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Of course it's never that easy. You'll also need to edit the /etc/init.d/mysql script, find the line near the top like:

basedir=.

And change it to read:

basedir=/usr/local/mysql

2. Setup the my.cnf file.

The default RHEL install of mysql which we are not using provided an default my.cnf file. It is workable but we want to be consistent with our production server so we'll copy it's my.cnf file to /etc/my.cnf.

If you don't want to copy the file from another server you can use one of the files provided as part of the mysql distribution in the support-files/ folder.

The my.cnf file that we are using moves the mysql data directroy to /var/lib/mysql.

3. Start the mysql server and set initial passwords.

Now we can start the mysql server with:

/sbin/service mysql start

And we can set the initial passwords with:


./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

4. Replace default mysql binary with a symlink to the new install.

We want to make sure that we use the new mysql binary instead of the old one. So we'll remove the old binary and symlink the new one in it's place.


rm /usr/bin/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql

And that's it!

July 2010
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Reliable Penguin offers Linux Server Migrations, Systems Administration & Programming. Visit our main website at:

http://www.reliablepenguin.com

Search

Bookmark and Share

XML Feeds

powered by b2evolution free blog software