centos8安装mysql

https://jingyan.baidu.com/article/8cdccae9bdef64705413cdd6.html

mysql8创建远程登录用户:

mysql,进入mysql

1.create user root@'%' identified  by 'root';      #创建远程登录用户及密码

2.grant all privileges on *.* to root@'%' with grant option;   #给远程登录用户赋值所有权限

3.ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';   #mysql8使用的是caching_sha2_password加密规则,最简单的方法是修改远程连接用户的加密规则为mysql_native_password

4.flush privileges;   #刷新一下,使配置生效

1.show global variables like 'port';   #查看数据库启用端口

1.检查远程服务器的防火墙:

  systemctl start firewalld # 开启防火墙
  systemctl stop firewalld  # 关闭防火墙
  systemctl status firewalld  #检查防火墙状态

2.如果防火墙开启,就将3306端口加入到防火墙中:

  查看防火墙开放的端口命令:firewall-cmd --list-ports

  向防火墙中添加端口,例如添加3306端口名利如下:

      firewall-cmd --permanent --zone=public --add-port=3306/tcp

  开启已经配置好的jenkins的端口,然后在重启防火墙,注意一定要重启防火墙,命令如下:

      systemctl reload firewalld

  

原文地址:https://www.cnblogs.com/jingzaixin/p/12758290.html