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

mysql源码安装(简化版)

时间:2015-09-09 11:33:59      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:mysql

1.添加组和用户

groupadd mysql

useradd -g mysql mysql -s /bin/false

mkdir /data/mysql -p

chown -R mysql:mysql /data/mysql

 

2.下载mysql

cd  /usr/local

wget http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.21.tar.gz

 

3.下载依赖包

yum install  -y bison cmake gcc gcc-c++ libaioncurses-devel

 

4.编译安装mysql

cd /usr/local

tar xf mysql-5.6.21.tar.gz

mv mysql-5.6.21 mysql

cd mysql

cmake .-DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql-DSYSCONFDIR=/etc

make;make install

 

5.优化和初始化mysql

rm -rf /etc/my.cnf

cd /usr/local/mysql

./scripts/mysql_install_db --user=mysql--basedir=/usr/local/mysql --datadir=/data/mysql #初始化mysql

ln -s /usr/local/mysql/my.cnf  /etc/my.cnf

cp ./support-files/mysql.server/etc/rc.d/init.d/mysqld

chmod 755 /etc/init.d/mysqld

chkconfig mysqld on

 

 

6.启动mysql

vi /etc/rc.d/init.d/mysqld

basedir=/usr/local/mysql   #添加

datadir=/data/mysql       #添加

  

service mysqld restart

echo "PATH=$PATH:/usr/local/mysql/bin">>/etc/profile

source /etc/profile


本文出自 “创新分享驰骋里外” 博客,请务必保留此出处http://10554846.blog.51cto.com/10544846/1692999

mysql源码安装(简化版)

标签:mysql

原文地址:http://10554846.blog.51cto.com/10544846/1692999

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