文章目录
1下载mysql 源
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
2yum源的安装
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
3yum命令安装mysql
yum -y install mysql-server
4启动mysql
systemctl start mysqld
5查看mysql状态
systemctl status mysqld
6获取mysql的临时密码
grep 'temporary password' /var/log/mysqld.log
7修改mysql的默认密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'admin';
8登录mysql
mysql -u root -p //mysql -u root -padmin
9开放3306端口
开放端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
– zone #作用域
– add-port=80/tcp #添加端口,格式为:端口/通讯协议
– permanent #永久生效,没有此参数重启后失效
重启防火墙
firewall-cmd --reload
10开启远程登录
grant all privileges on *.* to 'root'@'%' identified by 'admin' with grant option;