CentOS7_安装mysql5.7


wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

rpm -ivh mysql57-community-release-el7-8.noarch.rpm

yum -y install mysql-server

默认配置文件路径: 

配置文件:/etc/my.cnf 
日志文件:/var/log/var/log/mysqld.log 
服务启动脚本:/usr/lib/systemd/system/mysqld.service 
socket文件:/var/run/mysqld/mysqld.pid


启动mysql服务

service mysqld restart (systemctl start  mysqld.service)

查看mysql服务状态

service mysqld status (systemctl status mysqld.service)

重置密码

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

登录成功以后修改密码

默认是有对密码长度的限制的,所以设置的密码太简单的话,是通不过的

 1 mysql> SHOW VARIABLES LIKE 'validate_password%';
 2 +--------------------------------------+--------+
 3 | Variable_name                        | Value  |
 4 +--------------------------------------+--------+
 5 | validate_password_check_user_name    | OFF    |
 6 | validate_password_dictionary_file    |        |
 7 | validate_password_length             | 8      |
 8 | validate_password_mixed_case_count   | 1      |
 9 | validate_password_number_count       | 1      |
10 | validate_password_policy             | MEDIUM |
11 | validate_password_special_char_count | 1      |
12 +--------------------------------------+--------+
13 7 rows in set (0.01 sec)
14 
15 mysql> set global validate_password_policy=0;
16 Query OK, 0 rows affected (0.00 sec)
17 
18 mysql> set global validate_password_length=1;
19 Query OK, 0 rows affected (0.01 sec)

通过15行和18行的设置,就可以把密码设置成诸如root之类的简单密码了

修改完密码刷新权限

flush privileges;

把在所有数据库的所有表的所有权限赋值给位于所有IP地址的root用户

grant all on *.* to 'root'@'%' identified by 'root'  with grant option; 

但此时还有一个问题,就是因为安装了Yum Repository,以后每次yum操作都会自动更新,需要把这个卸载掉:

yum -y remove mysql57-community-release-el7-8.noarch