mysql5.6最小编译_CentOS 6.5最小化编译安装mysql 5.5.35

CentOS 6.5最小化编译安装mysql 5.5.35

1、关闭防火墙;[root@mysql ~]# service iptables stop

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Unloading modules:                               [  OK  ]

[root@mysql ~]# chkconfig iptables off

[root@mysql ~]# chkconfig iptables --list

iptables        0:off   1:off   2:off   3:off   4:off   5:off   6:off

2、关闭selinux;[root@mysql ~]# setenforce 0

[root@mysql ~]# vim /etc/sysconfig/selinux

修改下面这一行;SELINUX=disabled

[root@mysql ~]# getenforce

Permissive

3、安装mysql依赖包及编译工具;[root@mysql ~]# yum install -y ncurses-devel

[root@mysql ~]# yum install -y gcc gcc-c++

[root@mysql ~]# yum install -y cmake

4、安装前准备;

4.1、安装路径;[root@mysql ~]# mkdir /usr/local/mysql

4.2、数据库路径;[root@mysql ~]# mkdir /data/mysql -p

4.3、创建用户和用户组;[root@mysql ~]# groupadd mysql

[root@mysql ~]# useradd -r -g mysql -s /bin/false mysql

4.4、赋予数据存放目录权限;[root@mysql ~]# chown mysql:mysql -R /data/mysql

5、编译安装mysql 5.5.35;

5.1、编译安装mysql 5.5.35[root@mysql ~]# yum install -y lrzsz

root@mysql ~]# mkdir /package

[root@mysql ~]# cd /package/

[root@mysql package]# tar xf mysql-5.5.32.tar.gz

[root@mysql package]# cd mysql-5.5.32

[root@mysql mysql-5.5.32]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql/ -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306

[root@mysql mysql-5.5.32]# make && make install

5.2、复制配置文件;[root@mysql mysql-5.5.32]# cp support-files/my-small.cnf /etc/my.cnf

cp: overwrite `/etc/my.cnf'? yes

5.3、进入安装目录;[root@mysql mysql-5.5.32]# cd /usr/local/mysql/

[root@mysql mysql]# ll scripts/

total 16

-rwxr-xr-x. 1 root root 14816 Aug  2 00:13 mysql_install_db

5.4、初始化数据库;[root@mysql mysql]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/

5.5、创建管理数据库的脚本并添加到服务列表;[root@mysql mysql]# cp support-files/mysql.server /etc/init.d/mysqld

[root@mysql mysql]# chmod +x !$

chmod +x /etc/init.d/mysqld

[root@mysql mysql]# chkconfig --add mysqld

[root@mysql mysql]# chkconfig mysqld --list

mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

6、安装完成;

6.1、启动数据库;[root@mysql mysql]# /etc/init.d/mysqld start

Starting MySQL.. SUCCESS!

6.2、登陆数据库;[root@mysql mysql]# /usr/local/mysql/bin/mysql

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值