Вы находитесь на странице: 1из 3

Setting up MySQL on Linux

If you already have a MySQL server installed and running then you can use your current
installation with Weave. Weave can work with any version of the MySQL server. There are no
known issues with the older versions so far.

If you are installing MySQL for the first time, then you can install the latest version of MySQL
Community Server (version 5.5 as of writing this document) from the link below:

http://dev.mysql.com/downloads/mysql/

Download the “Compressed TAR Archive” (either 32-bit or 64-bit based on the machine you are
installing mysql in)

You do not need to register with MySQL to download the installer. Look for the “No Thanks,
Just take me to the downloads” link to download the installer directly.

You can choose any mirror to download the file. After downloading, run the file to launch the
installation.

Ideally you would have a database administrator doing the installation for your machine but if
you are not sure you can do a typical installation. We have provided instructions below to install
MySQL. Please note that the instructions are for typical use of MySQL and not necessarily the
recommended methods. If you know the correct options for your machine or Linux distribution
you can choose the appropriate options.
Step 1) Open the command line and make sure you are logged in as the root user. Now go to the
location when you downloaded the tar.gz file and extract the contents of the tar.gz file using:

> tar –xzf mysql-5.5.12-linux2.6-i686.tar.gz

Step 2) The content is extracted to a folder named mysql-5.5.12-linux2.6-


i686.tar.gz. Move the folder to the location where you want to install MySQL. For this
tutorial we will install it in /usr/local

> mv mysql-5.5.12-linux2.6-i686 /usr/local


Steps 3) Go to the installation directory

> cd /usr/local
Step 4) Add a symlink to the location

/usr/local> ln -s mysql-5.5.12-linux2.6-i686 mysql


Step 5) We will now create a user group called mysql and add user mysql to the group who will
have ownership access to the MySQL process. You can have another user name if required. Just
replace the name in the commands at the correct places. Also note that you are system might
already have a group and user named mysql. If so you can ignore these steps

/usr/local> cd mysql
/usr/local/mysql> groupadd mysql
/usr/local/mysql> useradd -g mysql mysql

Step 6) We will use the default configurations of MySQL for our installation. We will copy the
my-medium.cnf file to /etc.my.cnf.

The my.cnf file has the MySQL configurations and it first looks for the file in /etc/my.cnf.

/usr/local/mysql> cp support-files/my-medium.cnf /etc/my.cnf


Step 7) We will now run a script that will initialize the database and create default tables

/usr/local/mysql>./scripts/mysql_install_db --user=mysql
Step 8) Change the user:group ownership to ‘root:mysql’ for all files and directories under
/usr/local/mysql

/usr/local/mysql> chown -R root:mysql .


Change user:group ownership to ‘mysql:mysql’ under all files and directories of
/usr/local/mysql/data

/usr/local/mysql>chown -R mysql:mysql data

Step 9) Start the MySQL process

/usr/local/mysql>./bin/mysqld_safe --user=mysql &

Note: More documentation for installing MySQL on Linux is available here:

http://dev.mysql.com/doc/refman/5.5/en/linux-installation.html

There some useful information here about security, starting-stopping mysql , etc here:

http://dev.mysql.com/doc/refman/5.5/en/postinstallation.html

Вам также может понравиться