MySQL 5 In Debian Sarge (Stable ) HowTo

I needed to run mysql5 on another port on my server
with already 2 mysql servers (3.x and 4.x) on it
and for this i had to do following steps

wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.22.tar.gz/from/http://gd.tuwien.ac.at/db/mysql/

tar -zxvf mysql-5.0.22.tar.gz

cd mysql-5.0.22

sudo ./configure --prefix=/opt/mysql-5.0.22 --localstatedir=/opt/mysql-5.0.22 --with-innodb --without-debug --with-tcp-port=3308 --with-mysqld-user=mysql --with-unix-socket-path=/tmp/mysql-5.0.22.sock
make


sudo make install
sudo mkdir -p /var/lib/mysql5
sudo chown mysql.mysql /var/lib/mysql5
cd /opt/mysql-5.0.22/bin
sudo ./mysql_install_db --datadir=/var/lib/mysql5 --user=mysql


go to the source files

sudo cp mysql-5.0.22/support-files/mysql.server /etc/init.d/mysql-5.0.22


modify this variable in start-up script

datadir=/var/lib/mysql5

sudo vi /etc/init.d/mysql-5.0.1

create in /opt/mysql-5.0.22 my.cnf file with this content

$ cat my.cnf

[mysqld]
user = mysql
port = 3308

cd /etc/init.d

update-rc.d mysql-5.0.22 defaults


PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/mysql-5.0.22/bin/mysqladmin -u root password 'new-password'
/opt/mysql-5.0.22/bin/mysqladmin -u root -h example password
'new-password'

You can do the same thing from mysql batch processor
/opt/mysql-5.0.22/bin/mysql -u root -h

SET PASSWORD FOR 'root'@'example' = PASSWORD('******');
See the manual for more instructions.

You can start the MySQL daemon with:
cd /opt/mysql-5.0.22 ; /opt/mysql-5.0.22/bin/mysqld_safe &

or with the init.d script

cd /etc/init.d
# chmod +x mysql-5.0.22
# update-rc.d mysql-5.0.22


enjoy creating databases :)
/opt/mysql-5.0.22/bin/mysql -u root -h localhost.localdomain -P 3308 -p

Share this page:

0 Comment(s)