美文网首页
CentOS安装MySQL5.7(yum安装)

CentOS安装MySQL5.7(yum安装)

作者: 王哈哈就很棒 | 来源:发表于2020-05-30 13:26 被阅读0次

yum安装的目录结构

/var/lib/mysql                           mysql数据文件存放路径,可自定义 
/etc/my.cnf                              mysql配置文件路径
/usr/lib64/mysql                         mysql库文件路径
/usr/bin/mysql*                          mysql二进制可执行文件路径
/etc/rc.d/init.d/mysqld                  mysql服务管理脚本地址
/var/log/mysqld.log                      mysql日志文件路径

安装mysql的yum源

rpm  -ivh https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql57-community-release-el7-10.noarch.rpm

查看包

yum list | grep mysql-community-server

安装mysql

yum -y install mysql-community-server

启动服务

systemctl status mysqld
systemctl start mysqld

日志文件里查看临时密码, 登录成功时需要修改密码

grep "password" /var/log/mysqld.log

如果没有修改密码操作mysql会出现如下错误

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
在执行此语句之前,必须使用ALTER USER语句重置密码。

修改密码

alter user 'root'@'localhost' identified by 'Aa.bb9988';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
错误1819(HY000):您的密码不满足当前策略要求

密码复杂程度

select @@validate_password_policy;
set global validate_password_policy=0;

查询要求密码长度

select @@validate_password_length;
set global validate_password_length=1;

刷新权限表

flush privileges;

相关文章

网友评论

      本文标题:CentOS安装MySQL5.7(yum安装)

      本文链接:https://www.haomeiwen.com/subject/tqwczhtx.html