Install the compilation tool
- Yum install GCC gcc-C ++
- Yum install ncurses-devel
Download source code
- Mkdir-P/tmp
- CD/tmp
- Wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.15.tar.gz/from/http://mysql.he.net/
- Wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
- Wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
Install cmake and bison
- CD/tmp
- Tar zxvf cmake-2.8.4.tar.gz
- CD cmake-2.8.4
- ./Bootstrap
- Make
- Make install
- CD/tmp
- Tar zxvf bison-2.5.tar.gz
- CD bison-2.5
- ./Configure
- Make
- Make install
Compile and install MySQL
- /Usr/sbin/groupadd MySQL
- /Usr/sbin/useradd-G MySQL
- CD/tmp
- Tar xvf mysql-5.5.15.tar.gz
- CD mysql-5.5.15/
- Cmake-dcmake_install_prefix =/usr/local/MySQL \
- -Dmysql_unix_addr =/tmp/MySQL. Sock \
- -Ddefault_charset = utf8 \
- -Ddefault_collation = utf8_general_ci \
- -Dwith_extra_charsets = all \
- -Dwith_myisam_storage_engine = 1 \
- -Dwith_innobase_storage_engine = 1 \
- -Dwith_memory_storage_engine = 1 \
- -Dwith_readline = 1 \
- -Denabled_local_infile = 1 \
- -Dmysql_datadir =/var/MySQL/data \
- -Dmysql_user = MySQL
-
- Make
- Make install
For detailed compilation parameter reference: http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html
Related settings
- chmod + w/usr/local/MySQL
- chown-r MYSQL: MySQL/usr/local/MySQL
- ln-S/usr/local/MySQL/lib/libmysqlclient. so.16/usr/lib/libmysqlclient. so.16
- mkdir-P/var/MySQL/
- mkdir-P/var/MySQL/data/
- mkdir-P/var/MySQL/log/
- chown-r MYSQL: MySQL/var/MySQL/
- Cd support-files/
- CP my-large.cnf/var/MySQL/My. CNF
- CP mysql. Server/etc/rc. d/init. d/mysqld
-
- /usr/local/MySQL/scripts/mysql_install_db \
- -- defaults-file =/var/MySQL/My. CNF \
- -- basedir =/usr/local/MySQL \
- -- datadir =/var/MySQL/data \
- -- user = mysql
-
- chmod + x/etc/init. d/mysqld
- VI/etc/init. d/mysqld (edit this file, find and modify the following variable content :)
- Basedir =/usr/local/MySQL
- Datadir =/var/MySQL/Data
Add a startup Item:
- Chkconfig -- add mysqld
- Chkconfig -- level 345 mysqld on
Start the service:
- Service mysqld start
Set password:
- /Usr/local/MySQL/bin/mysqladmin password [New-Password]