赞
踩
你要在虚拟机中有一个CentOs的环境:VM部署CentOS并且设置网络_ZeroMaster的博客-CSDN博客
shell> wget https://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
shell> yum localinstall mysql57-community-release-el7-10.noarch.rpm
shell> yum install mysql-community-server
可能会出现如下错误:
源 "MySQL 5.7 Community Server" 的 GPG 密钥已安装,但是不适用于此软件包
执行下面语句就行
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
systemctl start mysqld
shell> systemctl enable mysqld
shell> systemctl daemon-reload
mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:
shell> grep 'temporary password' /var/log/mysqld.log
用VI 查看mysqld.log这个文件,找到 temporary password 后面跟着的密码,然后用这个密码登陆系统
shell> mysql -uroot -p
修改:密码最小长度策略
mysql> set global validate_password_length=0;
修改:密码强度检查等级策略,0/LOW、1/MEDIUM、2/STRONG
mysql> set global validate_password_policy=0;
修改密码
mysql> set password for 'root'@'localhost' = password('root123');
开启mysql的root用户远程连接服务(%号即远程连接,IDENTIFIED BY后面跟的密码)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root123' WITH GRANT OPTION;
刷新
mysql> flush privileges;
开启mysql端口服务
- /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
- service network restart
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。