码迷,mamicode.com
首页 > 数据库 > 详细

Mysql 源码安装

时间:2016-07-25 14:26:34      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:

# Redhat下的Mysql源码安装

##  Installing MySQL on Linux Using the MySQL Yum Repository
如果选择使用yum安装5.6版本
> Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
enabled=1
gpgcheck=1

shell> sudo yum install mysql-community-server

## 源码安装
### Source Installation System Requirements
* CMake, which is used as the build framework on all platforms
GNU make 3.75 or higher
* A working ANSI C++ compiler. GCC 4.2.1 or later
* erl is needed if you intend to run test scripts

### How to Get MySQL
选择自己的系统进行下载 ,直接下载.tar.gz源码

解压后的文件目录架构如下所示:
DirectoryContents of Directory
binscriptsmysqld server, client and utility programs
dataLog files, databases
docsMySQL manual in Info format
manUnix manual pages
includeInclude (header) files
libLibraries
shareMiscellaneous support files, including error messages, sample configuration files, SQL for database installation
sql-benchBenchmarks

### 开始安装
建立用户,解压文件
shell> groupadd mysql
shell> useradd  -g mysql  mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .

自定义数据文件的保存文件
shell> mkdir -p /data/mysql

初始化mysql,basedir 是解压安装文件的目录
shell>/script/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql/ 

修改配置文件 ,并建立配置文件短链接
vi /usr/local/mysql/my.cnf
basedir = /usr/local/mysql
datadir = /data/mysql
ln -s /usr/local/mysql/my.cnf /etc/my.cnf

shell> cp support-files/mysql.server /etc/init.d/mysqld     将常用启动服务放到/etc/init文件中

增加环境变量
vi /etc/profile
export PATH=$PATH:/usr/local/mysql/bin
source /etc/profile 立即生效配置

service mysqld start   启动mysql程序

添加自动启动
chkconfig --add mysqld
chkconfig mysqld on

### Mysql启动成功
技术分享
 




Mysql 源码安装

标签:

原文地址:http://www.cnblogs.com/roni/p/5703098.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!