Add a login user and group for mysqld to
useradd -g mysql mysql
These commands add the
mysql group and
mysql user. The syntax for
useradd and groupadd
may differ slightly on different versions of Unix, or they
may have different names such as adduser
You might want to call the user and group something else
mysql. If so, substitute the
appropriate name in the following steps.
Pick the directory under which you want to unpack the
distribution and change location into it.
Obtain a distribution file using the instructions in
Section 2.1.3, “How to Get MySQL”.
Unpack the distribution into the current directory:
/path/to/mysql-VERSION.tar.gz | tar xvf -
This command creates a directory named
With GNU tar, no separate invocation of
gunzip is necessary. You can use the
following alternative command to uncompress and extract the
Change location into the top-level directory of the unpacked
Note that currently you must configure and build MySQL from
this top-level directory. You cannot build it in a different
Configure the release and compile everything:
When you run configure, you might want to
specify other options. Run ./configure
--help for a list of options.
Section 2.8.2, “Typical configure Options”, discusses some of the
more useful options.
If configure fails and you are going to
send mail to a MySQL mailing list to ask for assistance,
please include any lines from
config.log that you think can help
solve the problem. Also include the last couple of lines of
output from configure. To file a bug
report, please use the instructions in
Section 1.8, “How to Report Bugs or Problems”.
If the compile fails, see
Section 2.8.4, “Dealing with Problems Compiling MySQL”, for help.
Install the distribution:
If you want to set up an option file, use one of those
present in the
as a template. For example:
cp support-files/my-medium.cnf /etc/my.cnf
You might need to run these commands as
If you want to configure support for
InnoDB tables, you should edit the
/etc/my.cnf file, remove the
# character before the option lines that
innodb_..., and modify the
option values to be what you want. See
Section 4.3.2, “Using Option Files”, and
Section 14.2.3, “
Change location into the installation directory:
If you haven't installed MySQL before, you must create the
MySQL grant tables:
If you run the command as
should use the
--user option as shown. The
value of the option should be the name of the login account
that you created in the first step to use for running the
server. If you run the command while logged in as that user,
you can omit the
After using mysql_install_db to create
the grant tables for MySQL, you must restart the server
manually. The mysqld_safe command to do
this is shown in a later step.
Change the ownership of program binaries to
root and ownership of the data directory
to the user that you run mysqld as.
Assuming that you are located in the installation directory
/usr/local/mysql), the commands look
chown -R root .
chown -R mysql var
chgrp -R mysql .
The first command changes the owner attribute of the files
root user. The second changes the
owner attribute of the data directory to the
mysql user. The third changes the group
attribute to the
If you want MySQL to start automatically when you boot your
machine, you can copy
support-files/mysql.server to the
location where your system has its startup files. More
information can be found in the
itself; see also Section 220.127.116.11, “Starting and Stopping MySQL Automatically”.
You can set up new accounts using the
bin/mysql_setpermission script if you
DBD::mysql Perl modules. For
instructions, see Section 2.13, “Perl Installation Notes”.