Linux安装MySQL

更新密钥

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

安装Mysql yum库

rpm -Uvh http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm

yum安装Mysql

yum -y install mysql-community-server

设置开机自启

systemctl start mysqld
systemctl enable mysqld
systemctl status mysqld // 检查Mysql服务状态

关闭防火墙

systemctl stop firewalld

systemctl disable firewalld

Linux有一个安全模块SELinux,用以限制用户和程序的相关权限,来确保系统的安全稳定。

vi /etc/sysconfig/selinux

SELINUX=disabled

image.png

查询默认密码

grep 'temporary password' /var/log/mysqld.log

image.png

登录客户端

第一次启动mysql,会在日志文件中生成root用户的一个随机密码,使用下面命令查看该密码。

mysql -uroot -p

降低设置密码安全级别

如果想设置简单密码,需要降低Mysql的密码安全级别。

set global validate_password_policy=LOW;

set global validate_password_Length=4;

设置密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';

grant all privileges on *.* to root@"%" identified by 'password' with grant option;

flush privileges;

常见BUG

错误码1045

关闭防火墙,并执行下面命令

grant all privileges on *.* to root@"%" identified by 'password' with grant option;

flush privileges;

IDEA:JDBC driver may have disabled TLS 1.1 and its earlier versions.

URL添加 enabledTLSProtocols=TLSv1.2

jdbc:mysql://localhost:3306?enabledTLSProtocols=TLSv1.2
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值