CentOS6.5上安装MysqL5.6及更改数据库目录
1 安装MysqL数据库
参考: http://www.jb51.net/article/58096.htm1) 查询已经安装的MysqL:
# rpm -qa | grep -i MysqLMysqL-libs-5.1.73-3.el6_5.x86_64 (系统自带,不删除)
2) 删除旧的:
//# rpm -e --nodeps MysqL-libs-5.1.73-3.el6_5.x86_643) 下载安装包:
# wget ftp://pub:pub@pepstack.com/rpm/MysqL-server-5.6.27-1.el6.x86_64.rpm# wget ftp://pub:pub@pepstack.com/rpm/MysqL-devel-5.6.27-1.el6.x86_64.rpm
# wget ftp://pub:pub@pepstack.com/rpm/MysqL-client-5.6.27-1.el6.x86_64.rpm
4) 安装MysqL数据库
# rpm -ivh MysqL-server-5.6.27-1.el6.x86_64.rpm MysqL-client-5.6.27-1.el6.x86_64.rpm MysqL-devel-5.6.27-1.el6.x86_64.rpmerror: Failed dependencies:
libnuma.so.1()(64bit) is needed by MysqL-server-5.6.27-1.el6.x86_64
libnuma.so.1(libnuma_1.1)(64bit) is needed by MysqL-server-5.6.27-1.el6.x86_64
libnuma.so.1(libnuma_1.2)(64bit) is needed by MysqL-server-5.6.27-1.el6.x86_64
# yum install numactl
# rpm -ivh MysqL-server-5.6.27-1.el6.x86_64.rpm MysqL-client-5.6.27-1.el6.x86_64.rpm MysqL-devel-5.6.27-1.el6.x86_64.rpm
# rpm -qa | grep -i MysqL
MysqL-server-5.6.27-1.el6.x86_64
MysqL-client-5.6.27-1.el6.x86_64
MysqL-devel-5.6.27-1.el6.x86_64
# chkconfig MysqL on
5) 查看使用的my.cnf
# MysqL --help | grep my.cnf6) 复制一个my.cnf
# cp /usr/share/doc/MysqL-server-5.6.27/my-default.cnf /etc/my.cnf7) 启动MysqL server
# service MysqL start
# cat /root/.MysqL_secret
# The random password set for the root user at Mon Apr 24 16:37:19 2017 (local time): 1VSt46KA3RHO1ZhJ
# MysqL u root -p1VSt46KA3RHO1ZhJ
MysqL> SET PASSWORD = PASSWORD('abc123');
2 更换MysqL数据库的数据文件目录
默认在:/var/lib/MysqL
1) 查看datadir
# MysqLadmin -u root -p variables|grep datadir| datadir | /var/lib/MysqL/