当前位置:Gxlcms > 数据库问题 > 记录下 rhel 7 安装MySQL 并重置root密码

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

时间:2021-07-01 10:21:17 帮助过:33人阅读

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   

人气教程排行