CentOS7 MySQL安装

0 准备工作

yum换源:https://www.cnblogs.com/lgjb/p/17293111.html

1 下载yum Repository

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

2 安装yum Repository

yum -y install mysql57-community-release-el7-10.noarch.rpm

3 安装mysql5.7

yum -y install mysql-community-server

有时会出现比较稀有的问题需跳过密钥检查机制

yum -y install --nogpgcheck mysql-community-server

4 启动mysql

systemctl start mysqld.service

查看mysql状态

systemctl status mysqld.service

5 设置密码

获取临时密码

grep "password" /var/log/mysqld.log

把获取的临时密码拷贝一下,登录mysql

mysql -uroot -p[粘贴上刚刚获取的临时密码]

关闭密码复杂验证

set global validate_password_policy=0;
set global validate_password_length=1;

设置密码,设置自己的密码,这里设置为123456

alter user user() identified by "123456";

6 卸载yum Repository

yum -y remove mysql57-community-release-el7-10.noarch

参考链接:https://blog.csdn.net/hujieliang123/article/details/122407525

posted @ 2023-04-06 16:18  来个煎饼  阅读(26)  评论(0编辑  收藏  举报