Database Reference
In-Depth Information
decide between 32-bit, 64-bit, and SPARC versions, depending on the type of processor
used on your server. For MariaDB, there is only a 64-bit version.
There are also TAR files,combining the MySQL files. The FreeBSD files are available
only in TAR packages and only for MySQL. For MariaDB, you will have to compile the
source files. If you download the TAR files, you will need a copy ofGNU's
tar
and
GNU's
gunzip
to unpack the installation files. These tools are usually included on Sun
Solaris and FreeBSD systems. If your system doesn't have them, though, you can down-
load them from the
GNU Foundation site
.
Once you've chosen and downloaded an installation package, enter something like the fol-
lowing from the command line asrootto begin the installation process:
groupadd mysql
useradd -g mysql mysql
cd /usr/local
tar xvfz /tmp/mysql-
version
.tar.gz
These commands are the same for both MySQL and MariaDB. The first command creates
the user group,
mysql
. The second creates the user,
mysql
, and adds it to the
mysql
group
at the same time. The next command changes to the directory where the MySQL files are
about to be extracted. The last line uses the
tar
utility (along with
gunzip
via the
z
option)
to unzip and extract the distribution files. The word
version
in the name of the installa-
tion file should be replaced with the version number — that is to say, use the actual file
path and name of the installation file that you downloaded as the second argument of the
tar
command. For Sun Solaris systems, you shoulduse
gtar
instead of
tar
.
After running the previous commands, you need to create a symbolic link to the directory
created by
tar
in
/usr/local
:
ln -s /usr/local/mysql-
version
/usr/local/mysql
This creates
/usr/local/mysql
as a link to
/usr/local/mysql-
version
, where
mysql-
ver-
sion
is the actual name of the subdirectory that
tar
created in
/usr/local
. The link is ne-
cessary, because MySQL is expecting the software to be located in
/usr/local/mysql
and
the data to be in
/usr/local/mysql/data
by default.
At this point, MySQL or MariaDB is basically installed. Now you must generate the ini-
tial user privileges or grant tables, and change the file ownership of the related programs
and data files. To do these tasks, enter the following from the command line:
cd /usr/local/mysql
./scripts/mysql_install_db