MySQL II : 4.x Installation

Installing MySQL 4.x and Earlier

1. Before starting, install the MySQL servers, clients and development libraries. Run these queries, and if necessary, install the related packages:

rpm -q mysql
rpm -q mysql-server
rpm -q mysql-devel
rpm -q MySQL-python
rpm -q perl-DBD-MySQL
rpm -q php-mysql

-and any other indicated dependencies as necessary.

The easiest way to install all of these is from the Fedora Core 4 CDs or DVD. If you go to the Internet and get “aftermarket” RPMs, be SURE the version numbers match exactly!

When you install from the Fedora CDs or RPMs, the mysql user and group will be created automatically, and directory permissions will be pre-set for you.

2. Set the root user’s password for MySQL:

msqladmin -u root password ‘private’

I will be using, as a default, the password “private” for all root connections.

4. Create a user configuration file for root:

vi ~/.my.cnf

Then in vi:

[client]
password=’private’

 

Return to Intermediate MySQL Home Page

 

Go to http://dev.mysql.com/downloads/mysql/ get MySQL server and client. Copy or move both to /usr/local/ and unpack them:

tar -zxvf mysql-standard-<version>.tar.gz
tar -zxvf mysql-client-<version>.tar.gz

You’ll end up with a directories named like mysql-standard-<version>.tar.gz_FILES. I prefer to cd into these and then move the mysql-standard-<version> directories up outside it, and delete the _FILES directories.

Create symbolic links to the new directories:

ln –s /usr/local/mysql-<version> mysql

Create a mysql user and group:

useradd mysql
<enter a password, twice>

Move to the MySQL directory:

cd mysql

Configure and install:

./configure –prefix=/usr/local/mysql

Note that if you install MySQL 5.0 or later this way, you will not run the following two commands.

make
make install

Install the default databases:

cd /usr/local/mysql/scripts
./mysql_install_db
cd ..

Change the permissions on the new files, which allows MySQL to run as the new mysql user that you created earlier:

chown –R root /usr/local/mysql/
chown –R mysql /usr/local/mysql/data
chgrp –R mysql /usr/local/mysql/

2. If you will be adding Python, also get the mysql-devel package (it’s labeled “Libraries and header files”).