【Linux】CentOS6上mysql5.7安装

1.下载安装yum源

根据系统下载yum源mysql

https://dev.mysql.com/downloads/repo/yum/sql

rpm -ivh xxxxx.rpmshell

2.修改yum源

vim /etc/yum.repos.d/mysql-community.repo数据库

enable想要下载的版本vim

3.安装mysql

yum install mysql-community-serverthis

4.启动

配置里修改了如下datadir路径spa

vim /etc/my.cnfserver

启动服务blog

service mysqld startit

查看root初始密码

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

登陆数据库

shell> mysql -uroot -p

 

此时使用会报错“You must reset your password using ALTER USER statement before executing this statement.” 

使用如下步骤设置新密码:

step 1: SET PASSWORD = PASSWORD('your new password');

step 2: ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;

step 3: flush privileges;

 设置完成后从新登陆数据库

相关文章
相关标签/搜索