
There are different methods to install MySQL community server on Linux.
- Install from source tar ball
- Install from rpm
- Installing binaries
- Install from Yum repository, Yast OR apt-get
Here we will deal with the 1st option – the installation of MySQL from the source. MySQL source can be compiled on either distribution of Linux for example fedora, centos, ubuntu & slacware etc.
The prerequisites of Installation
You must have superuser (root) privileges and user “mysql” already exists in your system. If not, create one:
groupadd mysql useradd -g mysql mysql
If you don’t know steps to compile source unpack, configure, make, make install:.
tar -xzf mysql-5.0.85.tar.gz cd mysql-5.0.37 ./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-collation=utf8_general_ci make make install
Configure /etc/my.cnf file
vi /etc/my.cnf
[mysqld] datadir=/usr/local/mysql/var socket=/tmp/mysql.sock
[mysql.server] user=mysql basedir=/usr/local/mysql/ [mysqld_safe] err-log=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
Installing mySQL database
/usr/local/mysql/bin/mysql_install_db --user=mysql
Now Start MySQL & change root password first
/usr/local/mysql/bin/mysqld_safe --user=mysql &;
Login to MySQL server
/usr/local/mysql/bin/mysql -u root
MySQL prompt appears as mysql> Issue following commands
DELETE FROM mysql.user WHERE User = '';
FLUSH PRIVILEGES;
SELECT Host, User FROM mysql.user;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');
SET PASSWORD FOR 'root'@'host_name' = PASSWORD('new_password');
FLUSH PRIVILEGES;
MySQL start-up script
cp support-files/mysql.server /etc/init.d/mysql chmod 755 /etc/init.d/mysql chkconfig --add mysql chkconfig --level 35 mysql on
I hop you’ll like this tricky howto. You comments will be really help for us.
