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

记录下 rhel 7 安装MySQL 并重置root密码

时间:2017-06-01 19:38:03      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:dev   get   environ   重置root密码   password   oar   https   string   emctl   

注意官方是很不提倡用root的。

下载并安装MySQL

最新的rpm地址 https://dev.mysql.com/downloads/repo/yum/

#wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm 
#rpm -ivh mysql57-community-release-el7-11.noarch.rpm
#yum install mysql-server

重置root密码

# systemctl stop mysqld
# systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
# systemctl start mysqld
# mysql -u root

mysql>  UPDATE mysql.user
    ->     SET authentication_string = PASSWORD(password), password_expired = N
    ->     WHERE User = root AND Host = localhost;
    ->     FLUSH PRIVILEGES;
    ->     quit

# systemctl stop mysqld
# systemctl unset-environment MYSQLD_OPTS
# systemctl start mysqld
# mysql -u root -p
Enter password: 

mysql> show databases;

 

记录下 rhel 7 安装MySQL 并重置root密码

标签:dev   get   environ   重置root密码   password   oar   https   string   emctl   

原文地址:http://www.cnblogs.com/wjshan0808/p/6930284.html

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