最近我和伟少正在搭建一个新框架,虚拟机使用VirtualBox,虚拟系统CentOS7,数据库使用MySQL5.7.18,这个版本的MySQL和之前的版本安装还有些差异。
这里使用rpm安装,从头开始:
rpm -qa | grep -i mysql
rpm -e --nodeps mysql
删除干净历史版本,下载如下rpm:
mysql-community-client-5.7.18-1.el7.x86_64.rpm
mysql-community-common-5.7.18-1.el7.x86_64.rpm
mysql-community-libs-5.7.18-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.18-1.el7.x86_64.rpm
mysql-community-server-5.7.18-1.el7.x86_64.rpm
libs-common-client-server依次安装,注意官方文档给出的配置说明:
systemctl start mysqld.service 启动mysql。
错误说明:
1.如果遇到如下冲突提示:
file /usr/share/mysql/czech/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
file /usr/share/mysql/danish/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
file /usr/share/mysql/dutch/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
file /usr/share/mysql/english/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
file /usr/share/mysql/estonian/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
file /usr/share/mysql/french/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
file /usr/share/mysql/german/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
file /usr/share/mysql/greek/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
file /usr/share/mysql/hungarian/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
请执行:yum -y remove mariadb-liv-*,删除多余的package
2.安装完成后启动mysql,初始密码在:/var/log/mysqld.log
grep 'temporary password' /var/log/mysqld.log
3.初次登陆后,MySQL强烈要求修改密码,至少包含:大写字母,小写字母,数字,特殊字符
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
4.其他客户端连接MySQL服务器,需要添加账号,主机信息
create user 'root'@'192.168.56.1' identified by 'MysqlClient5.7';
grant all on *.* to 'root'@'192.168.56.1';
flush privileges;
这样客户端192.168.56.1的主机就可以连接mysql服务器。
喜欢请关注微信公众号:码农小麦