mysql部署
进入官网
https://www.mysql.com/
https://dev.mysql.com/downloads/file/?id=513590
右键复制链接地址
在linux下载mysql
创建downloadfile
mkdir /home/downloadfile
cd /home/downloadfile
下载mysql
wget -i -c https://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm
使用yum安装
yum install -y mysql80-community-release-el7-7.noarch.rpm
查看yum仓库是否有相关安装包
yum list mysql*
安装mysql服务器
yum install -y mysql-community-server.x86_64
启动服务
systemctl start mysqld
systemctl status mysqld
查看初始化密码并登录
grep 'password' /var/log/mysqld.log
mysql -u root -p
# 刚才看到的密码
修改mysql密码
alter user root@localhost identified by 'root'
# 或者
set password='root'
设置允许所有ip访问MYSQL8
切换数据库:use mysql;
查看用户:select host, user, authentication_string, plugin from user;
update user set host='%' where user='root';
刷新权限
FLUSH PRIVILEGES;
放行端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload