1. Ensure that you’re logged in as root:
[user@host]# su - root
2. Switch to the directory
containing the source tarball, and extract the files within it. (Note that you
will need approximately 80 MB of free space for the source tree.)
[root@host]# cd /tmp
[root@host]# tar -xzvf mysql-4.0.9-gamma.tar.gz
[root@host]# tar -xzvf mysql-4.0.9-gamma.tar.gz
Remember to replace the file
name in italics with the file name of your source tarball.
3. Move into the directory
containing the source code,
[root@host]# cd mysql-4.0.9-gamma
and take a look at the contents
with ls:
[root@host]# ls -l
Take a look at the sidebar
entitled “Up a Tree” for more information on what each directory contains.
4. Now, set variables for the
compile process via the included configure script. (Note the use of the --prefix argument to configure, which sets the default
installation path for the compiled binaries.)
[root@host]# ./configure
--prefix=/usr/local/mysql
5. Now compile the program
using make:
[root@host]# make
The compilation process takes a
fair amount of time (refer to the sidebar titled “Watching the Clock” for my
empirical observations on how long you’ll be waiting), so this is a good time
to get yourself a cup of coffee or check your mail.
Now that you’re all done, you
can test to ensure that everything is working properly.
6. Run the following command:
[root@host]# make tests
Handcrafting Your Build You can pass configure a number of command-line options that affect the build process. Here’s a list of the more interesting ones:
·
--prefix Sets the
prefix for installation paths
·
--without-server Disables
compilation of the server, and compiles only the MySQL client programs and
libraries
·
--localstatedir Sets the location in which the MySQL databases will be
stored
·
--with-charset Sets a
default character set
·
--with-debug Turns on extended debugging
·
--with-raid Enables RAID
support
·
--with-embedded-server Builds the
libmysqld embedded server library
·
--without-query-cache Disables the
query cache
·
--without-debug Disables debugging routines
·
--with-openssl Includes
OpenSSL support
Use the configure --help command to get a complete list of
options. |
Watching the Clock Compiling MySQL is a fairly time-consuming process, and you should be prepared to spend anywhere between 15 to 60 minutes on the task. The following table contains some empirical observations on the time taken to compile the program on various hardware configurations:
|
7. Install the MySQL binaries
to their new home in /usr/local/mysql:
[root@host]# make install
Figure 8 demonstrates what your
screen should look like during the installation process.
8. Create the special mysql
user and group with the groupadd and useradd commands:
[root@host]# groupadd mysql
[root@host]# useradd -g mysql mysql
[root@host]# useradd -g mysql mysql
9. Run the initialization
script, mysql_install_db, which
ships with the program, to prepare MySQL for operation:
[root@host]# /usr/local/mysql/scripts/mysql_install_db
10. Alter the ownership of the
MySQL binaries so that they are owned by root:
[root@host]# chown -R root
/usr/local/mysql
Now ensure that the newly minted
mysql user has read/write access to the MySQL data directories:
[root@host]# chown -R mysql
/usr/local/mysql/var
[root@host]# chgrp -R mysql /usr/local/mysql
[root@host]# chgrp -R mysql /usr/local/mysql
11. Start the MySQL server by
manually running the mysqld daemon:
[root@host]# /usr/local/mysql/bin/mysqld_safe
–-user=mysql &
MySQL should start up normally,
reading the base tables created in /usr/local/mysql/var.
At this point, you can proceed
to the section titled “Testing MySQL” to verify that everything is working as
it should.
Comments
Post a Comment