2019-01-13

mysql安装

1、下载安装mysql的yam源
从MySQL官网https://dev.mysql.com/downloads/repo/yum/查找最新yum源

下载yam源
wget  https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
安装yam源
rpm -ivh mysql57-community-release-el7-11.noarch.rpm 

2、安装mysql

安装mysql服务
yum install -y mysql-community-server
重启mysql服务
systemctl restart  mysqld.service

3、重置MySQL密码
使用MySql忘记密码操作流程。
(1)添加跳过授权
通过编辑(vim)/etc/my.cnf文件在[mysqld]下面加上skip-grant-tables=1,然后重启MySQL服务。
(2)重置mysql密码

无密码登陆
mysql -u root
切换到mysql数据库
use mysql
修改mysql密码
update 
     user set authentication_string = password('Root@123456'),
     password_expired='N',
     password_last_changed=now() 
where 
    user='root';

(3)修改/etc/my.cnf
通过编辑/etc/my.cnf 去掉 skip-grant-tables=1,然后重启MySQL服务。

你可能感兴趣的:(2019-01-13)