最简单之在线安装mysql

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   #关闭自启

 

作者:陈耿聪 —— 夕狱

出处:https://www.cnblogs.com/CGCong/

本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

原文地址:https://www.cnblogs.com/CGCong/p/12021169.html