My Agile Project

  • Increase font size
  • Default font size
  • Decrease font size
Home Documentation Howto How to install Mysql
Documentation

How to install Mysql

E-mail Print PDF

The article explain how to install Mysql on a linux server.

  1. With root user, create a user mysql with an home directory in /opt/mysql :
    1. useradd -d /opt/mysql mysql
     
  2. With the mysql user install the last stable version of apache (exemple 5.1.35).

    1. su - mysql
    2. tar xzvf mysql-5.1.35-linux-i686-glibc23.tar.gz
    3. mv mysql-5.1.35-linux-i686-glibc23 v5135
    4. ln -s v5135 current
     

  3. Copy your my.cnf file in /etc directory with root user
    1. su - root
    2. cp /opt/mysql/current/support-files/my-medium.cnf /etc/my.cnf
     
  4. Edit my.cnf file and add the 4 lines after [mysqld] (datadir is the path to your data directory)
    1. # The MySQL server
    2. [mysqld]
    3. basedir = /opt/mysql/current
    4. datadir = /data/db
    5. default-storage-engine=InnoDB
    6. user=mysql
     
  5. In the mysql .bash_profile file update the path with $HOME/current/bin
    1. PATH=$PATH:$HOME/current/bin
    2. export PATH
     
  6. Automatic start and stop for Linux Redhat. With root copy mysql.server script in init.d directory.
    1. su -
    2. cp/opt/mysql/current/support-files/mysql.server /etc/rc.d/init.d/mysql
    3. chkconfig --add mysql
     
  7. Install DB
    1. su - mysql
    2. cd current
    3. ./scripts/mysql_install_db --user=mysql --basedir=/opt/mysql/current --datadir=/data/db
     
  8. Start and secure mysql
    1. su -
    2. service mysql start
    3. su - mysql
    4. cd current/bin
    5. ./mysql_secure_installation
     
Last Updated on Wednesday, 10 June 2009 07:43