centos7.3中安装mysql_CentOS7.3中安装MySQL5.6
在CentOS7.4中安装MysqL
使用rpm安装MysqL
1.下载
下载bundle版本的安装包,如下图:
2.安装
解压安装包,一般安装sever和client就可以满足大部分需求
在安装server的时候要注意,Centos7自带了一个mariadb-lib的包,会和server包的内容冲突,因此要先删掉自带的mariadb-lib包;使用 rpm -qa|grep mariadb 命令检查,然后使用 yum remove mariadb-libs-5.5.52-1.el7.x86_64 删除即可
rpm -ivh MysqL-server-5.6.20-1.rhel5.x86_64.rpm
rpm -ivh MysqL-client-5.6.20-1.rhel5.x86_64.rpm
rpm -ivh MysqL-devel-5.6.20-1.rhel5.x86_64.rpm
安装server出现的错误
[root@iz8vbevzhhalyp6vtmayu2z install]# rpm -ivh MysqL-server-5.6.20-1.rhel5.x86_64.rpm
error: Failed dependencies:
libaio.so.1()(64bit) is needed by MysqL-server-5.6.20-1.rhel5.x86_64
libaio.so.1(LIBAIO_0.1)(64bit) is needed by MysqL-server-5.6.20-1.rhel5.x86_64
libaio.so.1(LIBAIO_0.4)(64bit) is needed by MysqL-server-5.6.20-1.rhel5.x86_64
从以上错误信息可以看出是缺少库libaio,所以需要安装libaio
下载libaio:点击下载
rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm
安装完成后就可以安装server了
安装server又出现如下错误
[root@iz8vbevzhhalyp6vtmayu2z install]# rpm -ivh MysqL-server-5.6.20-1.rhel5.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:MysqL-server-5.6.20-1.rhel5 ################################# [100%]
warning: user MysqL does not exist - using root
warning: group MysqL does not exist - using root
FATAL ERROR: please install the following Perl modules before executing /usr/bin/MysqL_install_db:
Data::Dumper
从以上错误信息看出应该需要安装库perl
yum install -y perl-Module-Install.noarch
安装完之后继续安装server,到此MysqL安装完了
3.初始化MysqL及设置密码
systemctl start MysqL #Centos7开始使用systemctl的方式管理服务
查看root账号的密码及设置新密码
cat /root/.MysqL_secret
MysqL -uroot -p获取的密码
set password = password('新密码');
exit;
4.允许远程连接
因为MysqL默认没有开启远程连接,修改一下权限
grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;
flush privileges;
安装完毕!!!
总结
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您喜欢交流学习经验,点击链接加入交流1群:1065694478(已满)交流2群:163560250