0%

CentOS Install Mysql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
1.http://dev.mysql.com/downloads/repo/yum/ 地址下载相对应rpm包
2.rpm -ivh mysql57-community-release-el7-8.noarch.rpm (此时/etc/yum.reps.d/下已经有mysql地址源)
3.yum makecache
4.yum list | grep mysql(查询mysql-server)
5.yum install mysql-community-server.x86_64 进行安装
6.service mysqld restart
7.cat /var/log/mysqld.log | grep password
8.vi /etc/my.cnf ([mysqld] 下增加 validate-password=OFF 关闭密码长度等机制)
9.systemctl restart mysqld.service (重启服务)
10.mysql -uroot -p (登录mysql)
11.SET PASSWORD = PASSWORD('root');
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
flush privileges;
12.
client端用户命令:
GRANT ALL ON *.* TO root@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
(GRANT <privileges> ON <what> TO <user> [IDENTIFIED BY "<password>"] [WITH GRANT OPTION];)
(
打开MYSQL:service mysqld start
关闭MYSQL:service mysqld stop
)
13.firewall-cmd --zone=public --add-port=3306/tcp --permanent (防火墙)
systemctl stop firewalld
systemctl start firewalld