centos6.x Compile and install lamp (3): Compile and install MySQL5.5.25

Source: Internet
Author: User
Tags chmod soap iptables

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.

#编译安装

1 cd/usr/local/src/MySQL-5.5.25/cmake-2.8.8
2 ./configure
3 make&& makeinstall

2, compile and install the configuration MySQL

#切换至MySQL source extract directory

1 cd/usr/local/src/MySQL-5.5.25/mysql-5.5.25

#创建所需目录

1 mkdir-pv /usr/local/mysql/data

#创建mysql用户和mysql组

1 groupadd mysql
2 useradd-g mysql -s /usr/sbin/nologin mysql

#cmake编译

1 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

#安装

1 make&& makeinstall

#复制配置文件

1 cp./support-files/my-medium.cnf /etc/my.cnf

#设置权限

1 chmod+x /usr/local/mysql
2 chown-R mysql:mysql /usr/local/mysql
3 chown-R mysql:mysql /usr/local/mysql/data

#配置开机自动启动

1 cp./support-files/mysql.server /etc/init.d/mysqld
2 chmod+x /etc/init.d/mysqld
3 chkconfig --add mysqld
4 chkconfig --level 2345 mysqld on
5 chkconfig --list mysqld #查看是否已应用上

#添加MySQL的软链接以适应init脚本

1 ln-sv /usr/local/mysql/bin/mysql  /usr/sbin/mysql
2 ln-sv /usr/local/mysql/bin/mysqladmin  /usr/sbin/mysqladmin
3 ln-sv /usr/local/mysql/bin/mysqldump  /usr/sbin/mysqldump

#修改配置文件

1 vim /etc/my.cnf

add #在 the [mysqld] node:

1 datadir = /usr/local/mysql/data
2 log-error = /usr/local/mysql/data/error.log
3 pid-file= /usr/local/mysql/data/mysql.pid
4 user = mysql
5 tmpdir = /tmp

#保存退出

#初始化数据库

1 /usr/local/mysql/scripts/mysql_install_db  --user=mysql  --basedir=/usr/local/mysql  --datadir=/usr/local/mysql/data

#修改root密码

1 /usr/local/mysql/bin/mysqladmin -u root -p password "123456"

Configure the firewall to turn on port 3306

1 vim /etc/sysconfig/iptables

#添加如下规则到22 Ports under this rule, you can

1 -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

#重启防火墙

1 /etc/init.d/iptables restart  # 或  service iptables restart

Start MySQL

1 service mysqld start  # 或 /etc/init.d/mysqld start

Test if MySQL is started

#查看是否有mysql进程

1 ps-ef | grepmysql

#查看是否有mysql端口

1 netstat-ntlp | grep3306

#测试mysql, whether the mysqladmin,mysqldump command will work properly

#读取MySQL的版本信息

1 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:

1 ./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?

Related logs:

In CentOS5.5, compile and install mysql-5.5.32.tar.gz times wrong: ' ssl_op_no_compression ' is not declared (first used within this function)

Linux, how to install Pdo_mysql extensions to PHP

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 (4): Compile and install PHP5.2.17

Lamp One-click installation package-centos 5/6 automatically compile and install Apache, MySQL, PHP

centos6.x Compile and install lamp (4): Compile and install PHP5.3.27

CentOS compile install Apache 2.4.x times wrong: configure:error:Bundled APR requested but not found at./srclib/. Download and unpack the corresponding APR and Apr-util packages to./srclib/.

PHP5 do not recompile, how do I install a self-installed extension, such as a SOAP extension?

centos6.x Compile and install lamp (3): Compile and install MySQL5.5.25

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.