CentOS 6.5系统最小化编译安装mysql 5.5.35的详细步骤

下面一起来了解下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

看完CentOS 6.5系统最小化编译安装MysqL 5.5.35的详细步骤这篇文章后,很多读者朋友肯定会想要了解更多的相关内容,如需获取更多的行业信息,可以关注我们的行业资讯栏目。

相关文章

优化MySQL数据库发布系统存储的方法有:1.mysql库主从读写分...
使用mysql的方法:在“我的电脑”→右键→“管理”→“服务”...
在mysql中查看root用户权限的方法:1.命令行启动mysql服务;...
MySQL主从复制是用来备份一个与主数据库一样环境的从数据库,...
运行mysql的方法1.启动mysql服务,在“我的电脑”→右键→“...
开启mysql的方法1.可以通过快捷键win+r,输入cmd,打开窗口,...