CentOS6.5上安装MySQL5.6及更改数据库目录

CentOS6.5上安装MysqL5.6及更改数据库目录


1 安装MysqL数据库

参考: http://www.jb51.net/article/58096.htm

1) 查询已经安装的MysqL:

# rpm -qa | grep -i MysqL
MysqL-libs-5.1.73-3.el6_5.x86_64 (系统自带,不删除)

2) 删除旧的:

//# rpm -e --nodeps MysqL-libs-5.1.73-3.el6_5.x86_64

3) 下载安装包:

# 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.rpm
error: 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.cnf

6) 复制一个my.cnf

# cp /usr/share/doc/MysqL-server-5.6.27/my-default.cnf /etc/my.cnf

7) 启动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/

2) 更换到 /data/MysqL

# mv /var/lib/MysqL /data/ # cp /usr/share/MysqL/my-default.cnf /etc/my.cnf # vi /etc/my.cnf [client] port = 3306 socket = /data/MysqL/MysqL.sock (必须) [MysqLd] port = 3306 datadir=/data/MysqL socket=/data/MysqL/MysqL.sock # vi /etc/init.d/MysqL datadir=/data/MysqL 启动MysqL: # service MysqL start or # /etc/init.d/MysqL start 查看数据库的目录: # MysqLadmin -u root -p variables|grep datadir Enter password: | datadir | /data/MysqL/ 结束!

相关文章

有时候CentOS工作在无互联网的环境下,需要在离线环境下安装一些组件,这次实现的是模拟在离线环境下安...
首先参照https://www.cnblogs.com/wdw984/p/13330074.html,来进行如何安装Centos和离线下载rpm包。 离...
有两个.NET CORE3.1网站部署在CentOS7上(内网IP是192.168.2.32),现在想实现访问http://192.168.2.32...
1、yum -y install vsftpd 安装vsftpd 2、配置vsftpd的配置文件(/etc/vsftpd/vsftpd.conf)主要修改以...
首先去mysql官网下载mysql的离线rpm安装包(https://downloads.mysql.com/archives/community/) Mysql...
第一步下载erlang环境并安装: wget https://packages.erlang-solutions.com/erlang/rpm/centos/7/x86_...