CentOS7用yum安装MySQL与启动

首先CentOS7 已经不支持mysql,因为收费了你懂得,所以内部集成了mariadb,而安装mysql的话会和mariadb的文件冲突,所以需要先卸载掉mariadb,以下为卸载mariadb,安装mysql的步骤。

#列出所有被安装的rpm package 
rpm -qa | grep mariadb

#卸载
rpm -e mariadb-libs-5.5.37-1.el7_0.x86_64
错误:依赖检测失败:
libmysqlclient.so.18()(64bit) 被 (已安裝) postfix-2:2.10.1-6.el7.x86_64 需要
libmysqlclient.so.18(libmysqlclient_18)(64bit) 被 (已安裝) postfix-2:2.10.1-6.el7.x86_64 需要

#强制卸载,因为没有--nodeps
rpm -e --nodeps mariadb-libs-5.5.37-1.el7_0.x86_64

#安装mysql依赖
yum install vim libaio net-tools

其他情况:

1、centos下yum暂时没有mysql-server直接安装包;
MariaDB是MySQL社区开发的分支,也是一个增强型的替代品;

2、安装MariaDB
yum -y install mariadb-server mariadb mariadb-devel
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
firewall-cmd --permanent --add-service mysql
systemctl restart firewalld.service
iptables -L -n|grep 3306

In order to log into MariaDB to secure it, we\'ll need the current password for the root user. If you\'ve just installed MariaDB, and you haven\'t set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): ERROR 1045 (28000): Access denied for user \'root\'@\'localhost\' (using password: YES)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzwsxg.html