sudo apt-get install CMake
sudo apt-get install Libncurses5-dev
sudo apt-get install Bison
sudo groupadd MySQL
sudo useradd-s/sbin/nologin-m-g MySQL MySQL
Tar zxvf mysql-5.5.28.tar.gz
CD mysql-5.5.28/
Cmake-dcmake_install_prefix=/data/mysql/mysql \
-dmysql_unix_addr=/data/mysql/log/mysql.sock \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-DWITH_EXTRA_CHARSETS:STRING=UTF8,GBK \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_readline=1 \
-denabled_local_infile=1 \
-dmysql_datadir=/data/mysql/mysqldata \
-dmysql_tcp_port=3306 \
-dmysql_user=mysql
Make
Make install
CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
Sed '/skip-external-locking/i\datadir =/data/mysql/mysqldata '-i/etc/my.cnf
if [$installinnodb = "Y"]; Then
Sed-i ' s: #innodb: Innodb:g '/etc/my.cnf
Sed-i ' S:/usr/local/mysql/data:/data/mysql/mysqldata:g '/etc/my.cnf
Else
Sed '/skip-external-locking/i\default-storage-engine=myisam\nloose-skip-innodb '-i/etc/my.cnf
Fi
/data/mysql/mysql/scripts/mysql_install_db--defaults-file=/etc/my.cnf--basedir=/data/mysql/mysql--datadir=/ Data/mysql/mysqldata--user=mysql
Chown-r Mysql/data/mysql/mysqldata
Chgrp-r Mysql/data/mysql/mysql.
CP Support-files/mysql.server/etc/init.d/mysql
chmod 755/etc/init.d/mysql
Cat >/etc/ld.so.conf.d/mysql.conf<<eof
/data/mysql/mysql/lib
/usr/local/lib
Eof
Ldconfig
Ln-s/data/mysql/mysql/usr/lib/mysql
Ln-s/data/mysql/mysql/include/mysql/usr/include/mysql
If [-D "/proc/vz"];then
Ulimit-s Unlimited
Fi
/etc/init.d/mysql start
Ln-s/data/mysql/mysql/bin/mysql/usr/bin/mysql
Ln-s/data/mysql/mysql/bin/mysqldump/usr/bin/mysqldump
Ln-s/data/mysql/mysql/bin/myisamchk/usr/bin/myisamchk
Ln-s/data/mysql/mysql/bin/mysqld_safe/usr/bin/mysqld_safe
/data/mysql/mysql/bin/mysqladmin-u Root Password $mysqlrootpwd
Cat >/tmp/mysql_sec_script<<eof
Use MySQL;
Update user set Password=password (' $mysqlrootpwd ') where user= ' root ';
Delete from user where not (user= ' root ');
Delete from user where user= ' root ' and password= ';
drop database test;
DROP USER ' @ '% ';
Flush privileges;
Eof
MySQL Installation documentation