The required source code package:
/usr/local/src/mysql-5.5.25/cmake-2.8.8.tar.gz
/usr/local/src/mysql-5.5.25/mysql-5.5.25.tar.gz
1, installation CMake
MySQL has been removed from version 5.5, and is replaced by the CMake tool./configure.
Therefore, we first need to compile and install the CMake tool in the system source code.
#编译安装
Cd/usr/local/src/mysql-5.5.25/cmake-2.8.8./configuremake && make Install
2, compile and install the configuration MySQL
#切换至 MySQL Source Unzip Directory
cd/usr/local/src/mysql-5.5.25/mysql-5.5.25
#创建所需目录
Mkdir-pv/usr/local/mysql/data
#创建mysql用户和mysql组
Groupadd mysqluseradd-g mysql-s/usr/sbin/nologin MySQL
#cmake编译
CMake -dcmake_install_prefix=/usr/local/mysql -dmysql_datadir=/usr/local/mysql/data -DDEFAULT_ Charset=utf8 -ddefault_collation=utf8_unicode_ci -dwith_readline=1 -dwith_ssl=system -DWITH_ Embedded_server=1 -denabled_local_infile=1 -ddefault_collation=utf8_general_ci -DWITH_MYISAM_ storage_engine=1 -dwith_innobase_storage_engine=1 -dwith_debug=0
#安装
Make && make install
#复制配置文件
CP./SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
#设置权限
chmod +x/usr/local/mysqlchown-r mysql:mysql/usr/local/mysqlchown-r Mysql:mysql/usr/local/mysql/data
#配置开机自动启动
CP./support-files/mysql.server/etc/init.d/mysqldchmod +x/etc/init.d/mysqldchkconfig--add mysqldchkconfig--level 2345 mysqld onchkconfig--list mysqld #查看是否已应用上
#添加MySQL的软链接以适应init脚本
Ln-sv/usr/local/mysql/bin/mysql /usr/sbin/mysqlln-sv/usr/local/mysql/bin/mysqladmin /usr/sbin/ Mysqladminln-sv/usr/local/mysql/bin/mysqldump /usr/sbin/mysqldump
#修改配置文件
Vim/etc/my.cnf
Add #在 the [mysqld] node:
DataDir =/usr/local/mysql/datalog-error =/usr/local/mysql/data/error.logpid-file =/usr/local/mysql/data/ Mysql.piduser = Mysqltmpdir =/tmp
#保存退出
#初始化数据库
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/ Local/mysql/data
#修改root密码
/usr/local/mysql/bin/mysqladmin-u root-p Password "123456"
Configure the firewall to turn on port 3306
Vim/etc/sysconfig/iptables
#添加如下规则到22 Ports under this rule, you can
-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
#重启防火墙
/etc/init.d/iptables Restart # or service iptables restart
Start MySQL
Service mysqld start # or/etc/init.d/mysqld start
Test if MySQL is started
#查看是否有mysql进程
Ps-ef | grep MySQL
#查看是否有mysql端口
NETSTAT-NTLP | grep 3306
#测试mysql, whether the mysqladmin,mysqldump command will work properly
#读取MySQL的版本信息
Mysqladmin version
To this MySQL compilation installation is complete.
MySQL5.5 Previous versions (such as mysql5.1.x) . The/configure compilation reference is as follows:
./configure--prefix=/usr/local/mysql/--localstatedir=/usr/local/mysql/data--without-debug-- With-unix-socket-path=/tmp/mysql.sock--with-client-ldflags=-all-static--with-mysqld-ldflags=-all-static-- Enable-assembler--with-extra-charsets=gbk,gb2312,utf8--with-pthread
Extended reading:
centos6.x Compile and install lamp (1): Ready to work
centos6.x Compile and install lamp (2): Compile and install Apache2.2.25
centos6.x Compile and install lamp (2): Compile and install Apache2.4.6
centos6.x Compile and install lamp (3): Compile and install MySQL5.5.25
centos6.x Compile and install lamp (4): Compile and install PHP5.2.17
centos6.x Compile and install lamp (4): Compile and install PHP5.3.27
PHP5 do not recompile, how do I install a self-installed extension, such as a soap extension?
CentOS6.3 Compile and install lamp (3): Compile and install MySQL5.5.25