mysql 5.6 源码安装_mysql5.6源码安装

背景:现有mysql版本为5.5.40,考虑到以后需做主从,而5.6在主从方面、mysql读写方面都有很大提升。所以,准备升级。

官网:http://www.mysql.com/

环境:centos6.5 X86_64

安装目录:/database/mysql

解压目录:/database/mysql-5-6-24

数据存放目录:/database/sqldata

1、安装依赖包

yum install gcc gcc-c++ -y

yum install -y ncurses-devel

yum install -y openssl-devel(不安装会报错,见后文)

yum install -y cmake

yum install -y libaio

yum install -y bison

2、创建mysql用户用户组

groupadd mysql

useradd -g mysql mysql

3、cmake编译

tar –zxvf mysql-5.6.24.tar.gz

cd mysql-5-6-24cmake \

-DCMAKE_INSTALL_PREFIX:PATH=/database/mysql \

-DMYSQL_DATADIR:PATH=/database/sqldata \

-DEXTRA_CHARSETS=all \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_READLINE=1 \

-DMYSQL_USER=mysql \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_SSL=yes

报错:CMake Error at cmake/ssl.cmake:83 (MESSAGE):

Cannot find appropriate system libraries for SSL.  Use WITH_SSL=bundled to

enable SSL support

Call Stack (most recent call first):

CMakeLists.txt:255 (MYSQL_CHECK_SSL)

解决:安装openssl-devel,然后rm CMakeCache.txt。重新运行以上命令。

make && make install

次步时间比较长。#添加PATH

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

source /etc/profile#修改目录权限

chown -R mysql:mysql /database/mysql

chown -R mysql:mysql /database/sqldata

#拷贝配置文件

cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf#设置my.conf 在[mysqld]中设置

datadir=/database/sqldata

#初始化

scripts/mysql_install_db --user=mysql --datadir=/database/sqldata  --basedir=/database/mysql

日志:

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/db1/mysql/bin/mysqladmin -u root password 'new-password'

/db1/mysql/bin/mysqladmin -u root -h shekou password 'new-password'

Alternatively you can run:

/db1/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd . ; /db1/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file /db1/mysql/my.cnf on the system.

Because this file might be in use, it was not replaced,

but was used in bootstrap (unless you used --defaults-file)

and when you later start the server.

The new default config file was created as /db1/mysql/my-new.cnf,

please compare it with your file and take the changes you need.#设置mysql服务

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

chkconfig --add mysqld

service mysql start#空密码登陆mysql

mysql

4、mysql优化及其他操作(详见其他文章)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值