CentOS 7.6安装MySQL 5.7GA版
程序员文章站
2022-05-29 09:45:55
centos7 内部集成了mariadb,而安装mysql的话会和mariadb的文件冲突,所以需要先卸载掉mariadb。 ......
环境准备
- 卸载mariadb
rpm -qa | grep mariadb rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
centos7 内部集成了mariadb,而安装mysql的话会和mariadb的文件冲突,所以需要先卸载掉mariadb。
-
安装mysql
-
获取yum源(mysql官网)
-
安装yum源
rpm -uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
-
查看各版本启动状况
yum repolist all | grep mysql
默认开启最新版8.0
-
禁用8.0,开启5.7
yum-config-manager --disable mysql80-community yum-config-manager --enable mysql57-community
命令在yum-utils 包里,安装既可以解决无法找到yum-config-manager命令:
yum -y install yum-utils
-
安装mysqll
yum -y install mysql-community-server
-
配置mysql远程连接
-
查看mysql版本
mysql -v
-
启动mysql&&设置开机自启
systemctl start mysqld systemctl enable mysqld
-
查看默认生成密码
grep 'temporary password' /var/log/mysqld.log
-
登录修改密码
mysql -uroot -p
-
修改密码
alter user 'root'@'localhost' identified by 'nopassword564925080!'; mysql5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。否则会提示error 1819 (hy000): your password does not satisfy the current policy requirements错误.
-
授权远程登录用户
grant all privileges on *.* to 'noneplus'@'%' identified by 'noneplus564925080!' with grant option; flush privileges;
开放服务器3306端口
-
远程连接