欢迎访问30网!
15179563659
CentOS 7.6安装MySQL 5.7 GA版
卸载mariadb
rpm -qa | grep mariadb rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
CentOS 7.6 内部集成了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 -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端口
远程连接