How to change the MySQL root account password on CentOS7?

前端 未结 7 740
故里飘歌
故里飘歌 2020-12-12 08:58

I have installed mySQL on a Centos7 vm but I have problems logging in with root. I tried logging in without password or tried any default ones (like mysql, admin etc) I look

7条回答
  •  無奈伤痛
    2020-12-12 09:32

    Use the below Steps to reset the password.

    $ sudo systemctl start mysqld
    

    Reset the MySql server root password.

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

    Output Something like-:

     10.744785Z 1 [Note] A temporary password is generated for root@localhost: o!5y,oJGALQa
    

    Use the above password during reset mysql_secure_installation process.

        $ sudo mysql_secure_installation
    
    Securing the MySQL server deployment. Enter password for user root:

    You have successfully reset the root password of MySql Server. Use the below command to check the mysql server connecting or not.

    $ mysql -u root -p
    

    http://gotechnies.com/install-latest-mysql-5-7-rhelcentos-7/

提交回复
热议问题