博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

MySQL5.7.13源码编译安装指南(转)

Posted on 2016-09-16 16:20  moss_tan_jun  阅读(863)  评论(0编辑  收藏  举报

系统 CenterOs 6.5

1.安装依赖包(cmake make gcc等,其实好多都有了,不需要更新,为了防止世界被破坏,就装下)

复制代码
yum install gcc gcc-c++ -y
yum install -y ncurses-devel.x86_64
yum install -y cmake.x86_64
yum install -y libaio.x86_64
yum install -y bison.x86_64
yum install -y gcc-c++.x86_64
复制代码

2.安装boost库1.59(听高手们说,只能是这个版本,没试过其他的,懒是楼主的本性,于是菜鸟们跟着命令走吧)

wget http://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
tar zxvf  boost_1_59_0.tar.gz 
mv boost_1_59_0 /usr/local/boost

3.添加用户组和用户mysql(又是参考了各种大神的命令)

groupadd mysql          
useradd -g mysql mysql     

4.下载安装mysql5.7.13(下载时可能需要FQ?一直开着代理的楼主不知道是否需要FQ。。。接着就是需要root权限,当然这是确定的)

复制代码
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13.tar.gz

tar zxvf mysql-5.7.13.tar.gz cd mysql-5.7.13 cmake -DCMAKE_INSTALL_PREFIX=/home/mysql -DMYSQL_DATADIR=/home/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost make && make install
复制代码

5.初始化数据库(就是数据库的配置,呵呵,太给力的程序,大家要记住神一样的密码,楼主输错了无数次,终于成功)

/home/mysql/bin/mysqld --initialize --user=mysql --basedir=/home/mysql --datadir=/home/mysql/data
#返回信息最后一行 2016-07-21T07:36:45.962094Z 1 [Note] A temporary password is generated for root@localhost: KQqCK:lmC15u #密码要保存

6.调整配置文件(各种复制黏贴)

mv /etc/my.cnf /etc/my.cnf.bak
cp /home/mysql/support-files/my-default.cnf /etc/my.cnf

7.启动mySQl实例

/home/mysql/bin/mysqld_safe

8.另外开一个控制台,登陆mysql,然后输入那令人蛋疼的密码

cd /home/mysql/bin
./mysql  -uroot -p

9.修改密码 alter user 'root'@'localhost' identified by '123456';

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#提示信息
#Enter password:
#Welcome to the MySQL monitor.  Commands end with ; or \g.
#Your MySQL connection id is 3
#Server version: 5.7.13
 
#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.
 
mysql> alter user 'root'@'localhost' identified by '123456';

10.至此, mysql 5.7.13编译安装成功.