系统环境:Linux CentOS 6.7 X86_64
数据库软件:MySQL 5.7.13 二进制免编译包
Web服务软件:Apache 2.4.20
PHP软件:PHP 5.6.25
安装MySQL:
进入软件包存放目录:cd /usr/local/src
从官网或镜像站下载MySQL:wget http://downloads.mysql.com/archives/get/file/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
解压:tar zxf mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
移动目录:mv mysql-5.7.13-linux-glibc2.5-x86_64 /usr/local/mysql
创建用户mysql:useradd -s /sbin/nologin mysql
创建数据存放的目录datadir:mkdir -p /data/mysql
更改datadir的属组:chown -R mysql /data/mysql
进入安装目录:cd /usr/local/mysql
初始化数据库:./bin/mysqld --initialize --user=mysql --datadir=/data/mysql
拷贝配置文件:cp support-files/my-default.cnf /etc/my.cnf
修改配置文件:
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /data/mysql
port = 3306
# server_id = .....
socket = /tmp/mysql.sock
拷贝启动脚本:cp support-files/mysql.server /etc/init.d/mysqld
修改启动脚本:
basedir=/usr/local/mysql
datadir=/data/mysql
加入系统服务项,设定为开机启动:
[root@localhost mysql]# chkconfig --add mysqld
[root@localhost mysql]# chkconfig mysqld on
[root@localhost mysql]# service mysqld start
本文出自 “模仿游戏” 博客,请务必保留此出处http://kevinjin117.blog.51cto.com/11655131/1843797
原文地址:http://kevinjin117.blog.51cto.com/11655131/1843797