千家信息网

Liunx下mysql源码安装步骤

发表于:2026-11-02 作者:千家信息网编辑
千家信息网最后更新 2026年11月02日,这篇文章主要讲解了"Liunx下mysql源码安装步骤",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"Liunx下mysql源码安装步骤"吧!环境:虚拟
千家信息网最后更新 2026年11月02日Liunx下mysql源码安装步骤

这篇文章主要讲解了"Liunx下mysql源码安装步骤",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"Liunx下mysql源码安装步骤"吧!

环境:
虚拟机:CentOS-6.6-x86_64
mysql安装包:mysql-5.6.34

在安装源码包之前,需要安装一些rpm包
[root@potato ~]# rpm -qa|grep cmake
cmake-2.8.12.2-4.el6.x86_64
[root@potato ~]# rpm -qa|grep gcc
gcc-4.4.7-11.el6.x86_64
gcc-c++-4.4.7-11.el6.x86_64
[root@potato ~]# rpm -qa|grep make
make-3.81-20.el6.x86_64
[root@potato ~]# rpm -qa|grep make
[root@potato ~]# rpm -qa|grep libaio-devel
libaio-devel-0.3.107-10.el6.x86_64

创建用户mysql
[root@potato ~]# useradd mysql
从官网下载mysql数据库源码包,地址:
http://dev.mysql.com/downloads/mysql/
将下载的tar包进行解压
[root@potato ~]# cd Desktop/
[root@potato Desktop]#tar -zxvf /tmp/soft
创建软件存放目录
[root@potato Desktop]#mkdir /opt/mysql/mysql-5.6
[root@potato Desktop]#cd /tmp/soft
[root@potato soft]# cd mysql-5.6.34/
[root@potato mysql-5.6.34]#mkdir temp
开始编译,并指定软件存放目录
[root@potato temp]#cmake -DBUILD_CONFIG=mysql_release -DCMAKE_INSTALL_PREFIX=/opt/mysql/mysql-5.6 ..
[root@potato temp]#make -j
[root@potato temp]#make install
自此mysql软件安装完成

在/usr/local目录下配置mysql软连接,并设置PATH变量
[root@potato unbx]# cd /usr/local/
[root@potato local]# ln -s /opt/mysql/mysql-5.6 mysql
[root@potato local]# echo "PATH=$PATH:/usr/local/mysql/bin">>/etc/profile
[root@potato local]# source /etc/profile
[root@potato mysql]# echo $PATH
/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin:/usr/local/mysql/bin

创建data目录并赋权
[root@potato local]# mkdir -p /data/mysql/mytest_3306
[root@potato local]# chown -R mysql:mysql /data/mysql/mytest_3306
[root@potato local]# cd /usr/local/mysql
[root@potato mysql]# chown -R mysql:mysql *
创建配置文件my.cnf
[root@potato mysql]# cd /etc
[root@potato mysql]# vi /etc/my.cnf
注:可以在https://tools.percona.com,按步骤自动生成my.cnf
初始化数据库,指定my.cnf文件
[root@potato mysql]# ./scripts/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql

把mysql.server复制到/etc/init.d目录下,并开启mysql服务
[root@potato mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@potato mysql]# /etc/init.d/mysql start
Starting MySQL... SUCCESS!
连接mysql
[root@potato mysql]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.34-log Source distribution


Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


root@localhost:mysql.sock 14:22:29 [(none)]>\s
--------------
mysql Ver 14.14 Distrib 5.6.34, for Linux (x86_64) using EditLine wrapper


Connection id: 1
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.6.34-log Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /tmp/mysql.sock
Uptime: 1 min 12 sec


Threads: 1 Questions: 6 Slow queries: 0 Opens: 70 Flush tables: 1 Open tables: 63 Queries per second avg: 0.083
--------------

感谢各位的阅读,以上就是"Liunx下mysql源码安装步骤"的内容了,经过本文的学习后,相信大家对Liunx下mysql源码安装步骤这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是,小编将为大家推送更多相关知识点的文章,欢迎关注!

源码 步骤 目录 软件 学习 内容 数据 数据库 文件 配置 变量 地址 就是 思路 情况 文章 更多 环境 用户 知识 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 喔噻互联网科技有限公司 互联网通讯科技 互联网科技公司电话 北京互联网络科技有限公司 善班互联网科技有限公司 互联网 视角下的科技创新 互联网 新科技 四川狮子座互联网科技 山东吉时兔互联网科技有限公司 玖二柒互联网科技公司待遇 深圳前海聚择互联网科技有限公司 互联网时代科技改变生活 新兴科技互联网创新大赛颁奖典礼 科技赋能视角下互联网保险发展 济南有互联网科技公司吗 众安科技工业互联网合作 互联网第三次科技革命特征 互联网科技和医药行业 重庆科技产业互联网有哪些 互联网科技创业有什么好项目 互联网高科技 深圳科技互联网 万达互联网科技 互联网科技咨询 互联网科技公司招聘 湖南一路畅行互联网科技 特约风豹互联网科技为什么扣费 南通创西澳互联网科技有限公司 半导体行业属于互联网高科技类吗 数字互联网科技有限公司
0