linux下mysql源码包安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux下mysql源码包安装相关的知识,希望对你有一定的参考价值。

1.下载
下载地址:

 http://dev.mysql.com/downloads/mysql/5.6.html#downloads
 yeke

也可以直接复制下载命令

 wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz

2.安装依赖性文件

yum -y install cmake bison git ncurses-devel gcc gcc-c++

3.创建用户组

groupadd mysql
useradd -g mysql mysql

4.解压安装包。(我这里要在/usr/local/src下进行)

tar zxvf mysql-5.6.38.tar.gz -C /usr/local/src

#mkdir /usr/local/mysql
#mkdir /usr/local/mysql/data

5.cd mysql-5.6.38/ 开始编译

make ;
make install
6.修改目录属主权限

#chown -R mysql:mysql /usr/local/mysql/data/
#chown -R mysql:mysql /usr/local/mysql/

7.数据库初始化

scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/mysql --pid-file=/usr/local/mysql/data/mysql/mysql.pid --tmpdir=/tmp
到这里缺少文件perl-Data-Dumper.rpm
可以直接安装

rpm -ivh http://repo.openfusion.net/centos7-x86_64//perl-Data-Dumper-2.154-1.of.el7.x86_64.rpm

chown -R mysql:mysql my.cnf

8.配置文件 vim my.cnf

basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
#port = .....
#server_id = .....
socket = /usr/local/mysql/mysql.sock
log-error= /usr/local/mysql/data/error.log
pid-file = /usr/local/mysql/data/mysql.pid
user = mysql
tmpdir = /tmp

9.启动 cd /usr/local/mysql/support-files

./mysql.server start
cd /usr/local/mysql/bin
./mysql -u root -p

以上是关于linux下mysql源码包安装的主要内容,如果未能解决你的问题,请参考以下文章

linux平台下rpm方式和源码包方式安装mysql5.7

Linux下源码编译Mysql5.7

CentOS7.4下MySQL5.7.28源码方式安装

Linux下Mysql安装教程详解

Linux平台下安装MySQL

如何在linux下安装mysql数据库并配置