One, compile and install the first MySQL 5.1.33
cd/opt
/usr/sbin/groupadd MySQL
/usr/sbin/useradd-g MySQL mysql-s/bin/nologin-d/usr/local/mysql
TAR-ZXVF mysql-5.1.33.tar.gz
CD mysql-5.1.33/
./configure--prefix=/usr/local/mysql/--enable-assembler--with-extra-charsets=complex-- Enable-thread-safe-client--with-big-tables--with-readline--with-ssl--with-embedded-server--enable-local-infile --with-plugins=innobaseMake && make install
chmod +w/usr/local/mysql
Chown-r Mysql:mysql/usr/local/mysql
CP support-files/my-medium.cnf/usr/local/mysql/my.cnfCD.. /
attached: The following are additional steps, if you want to run the MySQL database on this server, perform the following two steps. If you just want PHP to support the MySQL extension library and be able to connect to the MySQL database on other servers, the following two stepsno need to execute.
①, create a data table as a MySQL user account:/usr/local/mysql/bin/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--user=mysql ②, starting MySQL (Last & indicates running in the background)/bin/sh/usr/local/mysql/bin/mysqld_safe--DEFAULTS-FILE=/USR/LOCAL/MYSQL/MY.CNF &
echo "/bin/sh/usr/local/mysql/bin/mysqld_safe--defaults-file=/usr/local/mysql/my.cnf &" >>/etc/rc.local
Ln-s/usr/local/mysql/bin/mysql/sbin/mysql
Ln-s/usr/local/mysql/bin/mysqladmin/sbin/mysqladmin
Mysqladmin-u Root Password 1234--Initialize root password
Mysqladmin-u root-p Password 456--Change the password that the root has set
Mysql-u Root-p--Connect to the database with a new password
add MySQL Account
Grant All on * * to' mysql3306 ' @ '% 'identified by ' mysql3306 '; --Add user mysql3306 for remote management of MySQL database
two, compile and install the second MySQL 5.1.33:Note: The first MySQL installation files can be copied all over, in order to be proficient in the installation process, here to re-install again
Cd/opt
/usr/sbin/useradd-g MySQL mysql3307-s/bin/nologin-d/usr/local/mysql3307
TAR-ZXVF mysql-5.1.33.tar.gz
CD mysql-5.1.33/
./configure--prefix=/usr/local/mysql3307/--enable-assembler--with-extra-charsets=complex-- Enable-thread-safe-client--with-big-tables--with-readline--with-ssl--with-embedded-server--enable-local-infile --with-plugins=innobase
Make;make Installchmod +w/usr/local/mysql3307
Chown-r mysql3307:mysql/usr/local/mysql3307
Chmod-r 777/usr/local/mysql3307
CP/USR/LOCAL/MYSQL/SHARE/MYSQL/MY-MEDIUM.CNF/USR/LOCAL/MYSQL3307/MY.CNFTo modify a configuration file:
Port = 3307--Modify ports
Socket =/tmp/mysql3307.sock--Modify sock# Here follows entries for some specific programs# The MySQL server
[Mysqld]
Port = 3307
Socket =/tmp/mysql3307.sock
①, create a data table as a MySQL user account:/usr/local/mysql3307/bin/mysql_install_db--basedir=/usr/local/mysql3307--datadir=/usr/local/mysql3307/data --user=mysql3307②, starting MySQL (Last & indicates running in the background)
/bin/sh/usr/local/mysql3307/bin/mysqld_safe--DEFAULTS-FILE=/USR/LOCAL/MYSQL3307/MY.CNF &
echo "/bin/sh/usr/local/mysql3307/bin/mysqld_safe--defaults-file=/usr/local/mysql3307/my.cnf &" >>/etc/ Rc.localNote: In the case of Warning world-writable config file '/usr/local/mysql3307/my.cnf ' is ignored
Workaround: chmod 644/usr/local/mysql3307/my.cnf
mysqladmin-p 3307-s/tmp/mysql3307.sock-u Root Password 1q2w3e--Initialize root password
Mysqladmin-p 3307-s/tmp/mysql3307.sock-u root-p Password 1q2w3e--Change the password that the root has set
/usr/local/mysql3307/bin/mysql-uroot-p-s/tmp/mysql3307.sockadd MySQL Account
Grant All on * * to' mysql3307 ' @ '% 'identified by ' mysql3307 '; --Add user mysql3307 for remote management of MySQL database