Você está na página 1de 2

!!

Goal: installing MySQL4 in Linux;


!! Author: Peter Slupski
!! For: mysql 4
Welcome!

Installing mysql can be a drudging experience, especially if you don't know where
to turn to ;) The mysql wiki does not always suit you with information, therefore
here I am to push you through the process.

Firstly, download mysql in a source distribution. You have to have:


GCC
BINUTILS
GNU MAKE
installed in order to compile the package.

The first problem I've encountered was not the compilation process (which is quite
straightforward) but chmoding and chowning the proper directories.
As you may have read somewhere, the var, tmp and data directories of mysql are
pretty important and the directory where you install mysql should be
distributed amongst only the proper users of a linux system.

Before compiling , do the following:

#!bash: groupadd mysql //In order to create a group


#!bash: useradd mysql //In order to create a user - note that
this command differs from the 'useradd -d #username#' which creates a user w/ his
home directory
#!bash: useradd -g mysql mysql //In order to add the mysql user to
the mysql group.

The above is quite important while compiling mysql. I presume you abide to the tip
;]
After that, you have to prepare your directory. Let's say, that I've chosen
/home/me/mysql to be the root directory of mysql.

#!bash: mkdir /home/me/mysql //We create the directory tree for


mysql.
#!bash: mdkir /home/me/mysql/tmp
#!bash: mdkir /home/me/mysql/var
#!bash: mdkir /home/me/mysql/data

Okay, so now we have an empty tree of directories and a usergroup with one user in
it ;]. I've read somewhere that if use gcc instead of g++, you'll recieve lighter
binaries and less redundant bits. Didn't test that yet, but hey -
there's always room for improvement.

Lets start configuring our database:

#!bash: cd /#MYSQL_SOURCE_DISTRIBUTION_DIRECTORY#/
#!bash: ./configure --prefix=/home/me/mysql --
localstatedir=/home/me/mysql/data --with-unix-socket-
path=/home/me/mysql/tmp/mysql.socket

The above does configure mysql so that you know where do you have your socket file
and you describe the data directory.
After running the command above, you wait for your makefile to generate. If you're
missing a dependency, just install it using your repo.
Now, we're ready to make the package. The files will appear in the mysql directory
tree we've built at line 26. (note 4 noobs - we're still in the mysql source
directory)

#!bash: make all install

Grab a tea and sit back for a couple minutes. It takes time to compile the good
stuff ;)

After you're done, you do the following:

#!bash: cd /home/me/mysql/bin
#!bash: ./mysql_install_db //This installs a database fileset into
/home/me/mysql/data - its the default directory, you can specify your own dir if
you look for it in --help.
#!bash: ./mysqld_safe -u root //You start your mysql daemon - this is
the moment that you start you database!
#!bash: ./mysqladmin -u root password #NEWPASSWORD# //Important: you set
your root password here!

Okay, so we're done! To access your database, just

#!bash: cd/home/me/mysq/bin
#!bash: ./mysql -u root -p //Logging in with the user root and a
password prompt!

Você também pode gostar