大家好,我是考100分的小小码 ,祝大家学习进步,加薪顺利呀。今天说一说centos安装mysql5.7,希望您对编程的造诣更进一步.
切换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
[[email protected] app]# grep ‘temporary password‘ /var/log/mysqld.log
2020-08-18T14:39:59.127422Z 1 [Note] A temporary password is generated for [email protected]: 2fdiYmMZ/<rW
登录mysql
mysql -u root -p
修改初始root密码
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘[email protected]‘;
授权其他机器登录
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘[email protected]‘ 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
原文地址:https://blog.51cto.com/cw666/2521588
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/6724.html