码迷,mamicode.com
首页 > 数据库 > 详细

centos安装mysql5.7

时间:2020-08-21 16:45:06      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:ali   oar   rpm -ivh   note   安装mysql   切换   log   wal   文件   

切换yum源

网易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

安装mysql5.7 yum源

        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)

安装mysql rpm包

rpm -ivh mysql57-community-release-el7-9.noarch.rpm

安装msyql

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   文件   

原文地址:https://blog.51cto.com/cw666/2521588

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!