1,下载Repo

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

2,安装repo

rpm -ivh mysql57-community-release-el7-10.noarch.rp
yum
-y install mysql57-community-release-el7-10.noarch.rpm

3,安装MySQL服务

yum -y install mysql-community-server

 4,启动服务

systemctl start  mysqld
systemctl status mysqld

5,查看密码

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

 6,修改密码

[root@192-168-**-** mysql5]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.28

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123abc****';
Query OK, 0 rows affected (0.01 sec)

7,允许简单密码

set global validate_password_policy=0;

set global validate_password_length=1;

#修改完成后再使用

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';  

8,远程连接

GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
#这里表示赋予该用户所有数据库所有表(*.*表示所有表),%表示所有IP地址。 FLUSH PRIVILEGES;#刷新权限 select user,host from mysql.user;#查看权限

9,关闭防火墙

systemctl stop firewalld  #关闭
systemctl disable firewalld   #关闭自启

 

posted on 2019-12-11 14:12  聪神carry  阅读(419)  评论(0)    收藏  举报