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

centos6.5 源码编译 mysql5.6.21

时间:2014-11-20 23:10:54      阅读:244      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   ar   os   sp   文件   数据   on   

1.yum安装各个依赖包
[root@WebServer ~]# yum -y install gcc gcc-devel gcc-c++ gcc-c++-devel autoconf* automake* zlib* libxml* ncurses-devel ncurses libgcrypt* libtool* cmake openssl openssl-devel bison bison-devel unzip

2.创建mysql安装目录和数据库目录
sudo mkdir -p /opt/mysql/database

3.更改mysql目录的权限为自己当前用户(我的用户名是colben)
sudo chown colben.colben /opt/mysql
sudo chown colben.colben /opt/mysql/ -R

4.解压mysql-5.6.21.tar.gz源码包
sudo tar zxvf ~/下载/mysql-5.6.21.tar.gz -C /usr/local/src/
sudo chown colben.colben /usr/share/src/mysql-5.6.21
sudo chown colben.colben /usr/share/src/mysql-5.6.21/ -R

5.下载gmock-1.6.0.zip,解压至源码中的source_downloads目录下

http://files.cnblogs.com/colben/gmock-1.6.0.zip

unzip ~/下载/gmock-1.6.0.zip
mv gmock-1.6.0 /usr/local/src/mysql-5.6.21/source_downloads/
cd /usr/local/src/mysql-5.6.21/source_downloads/gmock-1.6.0
./configure
make
cd ../../

6.编译安装

cmake \-DCMAKE_INSTALL_PREFIX=/opt/mysql \-DMYSQL_DATADIR=/opt/mysql/database \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_MEMORY_STORAGE_ENGINE=1 \-DWITH_ARCHIVE_STORAGE_ENGINE=1 \-DWITH_PARTITION_STORAGE_ENGINE=1 \-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DENABLE_DOWNLOADS=1 \-DENABLED_LOCAL_INFILE=1 \-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \-DMYSQL_TCP_PORT=3306 \-DEXTRA_CHARSETS=all \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci
make
make install

7.创建配置文件
cp /opt/mysql/support-files/my-default.cnf /opt/mysql/my.cnf

8.初始化数据库
/opt/mysql/scripts/mysql_install_db --user=colben --basedir=/opt/mysql --datadir=/opt/mysql/database    #注意这里的colben要改成自己的用户名

9.启动mysql服务
/opt/mysql/support-files/mysql.server start

10.设置MySQL root用户的密码
/opt/msql/bin/mysqladmin -u root password 123456    #修改mysql数据库的root账户密码是123456

11.删除密码为空的mysql账户
/opt/mysql/bin/mysql -uroot -p
提示输入密码,输入上一步我们设置的root密码:123456
进入mysql命令界面:
mysql>use mysql;
mysql>delete from user where password="";
mysql>flush privileges;
mysql>exit

结束

centos6.5 源码编译 mysql5.6.21

标签:blog   http   io   ar   os   sp   文件   数据   on   

原文地址:http://www.cnblogs.com/colben/p/4111625.html

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