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;
网友评论