码迷,mamicode.com
首页 > 数据库 > 详细

CentOS 7 安装mysql

时间:2018-06-08 00:48:32      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:load   生成   repo   get   5.7   mysq   roo   密码检查   domain   

1、配置yum源

下载mysql源安装包

shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

# 安装mysql源

shell> yum localinstall mysql57-community-release-el7-8.noarch.rpm

检查mysql源是否安装成功

shell> yum repolist enabled | grep "mysql.*-community.*"

2、安装MySQL

shell> yum install mysql-community-server

3、启动MySQL服务

shell> systemctl start mysqld

mysqld查看MySQL的启动状态

shell> systemctl status mysqld   #状态如下↓↓↓↓↓
 mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
Active: active (running) since 五 2016-06-24 04:37:37 CST; 35min ago
Main PID: 2888 (mysqld)
CGroup: /system.slice/mysqld.service
└─2888 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

6月 24 04:37:36 localhost.localdomain systemd[1]: Starting MySQL Server...
6月 24 04:37:37 localhost.localdomain systemd[1]: Started MySQL Server.

4、开机启动

shell> systemctl enable mysqld

shell> systemctl daemon-reload

5、修改root本地登录密码
mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:

shell> grep temporary password /var/log/mysqld.log

技术分享图片
shell> mysql -uroot -p

 Enter password: ?aeq,W;i7cnZ
mysql
> ALTER USER root@localhost IDENTIFIED BY MyNewPass4!; 或者 mysql> set password for root@localhost=password(MyNewPass4!);

 注意:mysql5.7以上版本默认安装了密码安全检查插件(validate_password),

默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。

否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements错误,如下图所示:

技术分享图片

 

默认配置文件路径:

配置文件:/etc/my.cnf 
日志文件:/var/log//var/log/mysqld.log 
服务启动脚本:/usr/lib/systemd/system/mysqld.service 
socket文件:/var/run/mysqld/mysqld.pid

 

CentOS 7 安装mysql

标签:load   生成   repo   get   5.7   mysq   roo   密码检查   domain   

原文地址:https://www.cnblogs.com/stationing/p/9153106.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!