时间:2021-07-01 10:21:17 帮助过:12人阅读
网易yum源:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
阿里云yum源:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
(如果虚拟机安装 可以使用wget http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm --no-check-certificate)
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
yum install mysql-server
启动mysql
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
查看默认密码
grep ‘temporary password‘ /var/log/mysqld.log
[root@localhost app]# grep ‘temporary password‘ /var/log/mysqld.log
2020-08-18T14:39:59.127422Z 1 [Note] A temporary password is generated for root@localhost: 2fdiYmMZ/<rW
登录mysql
mysql -u root -p
修改初始root密码
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘1qaz@WSX‘;
授权其他机器登录
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘1qaz@WSX‘ WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
开启防火墙:
systemctl status firewalld --查看防火墙状态
firewall-cmd --list-all --查看防火墙开放端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
--zone=public 添加时区
--add-port=8080/tcp 添加端口
--permanent 永久生效
firewall-cmd --reload --加载防火墙新配置文件( 以 root 身份输入以下命令,重新加载防火墙,并不中断用户连接,即不丢失状态信息. )
centos安装mysql5.7
标签:ali oar rpm -ivh note 安装mysql 切换 log wal 文件