MySQL root password change

前端 未结 22 2814
被撕碎了的回忆
被撕碎了的回忆 2020-11-29 18:30

I have been trying to reset my MySQL root password. I have run the mysqld_safe --skip-grant-tables, updated the root password, and checked the user table to make sure it is

相关标签:
22条回答
  • 2020-11-29 18:53

    For MySQL 5.7.6 and later:

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
    

    For MySQL 5.7.5 and earlier:

    SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
    
    0 讨论(0)
  • 2020-11-29 18:53

    Using the mysqladmin command-line utility to alter the MySQL password:

    mysqladmin --user=root --password=oldpassword password "newpassword"
    

    Source

    0 讨论(0)
  • 2020-11-29 18:58

    Please follow the below steps.

    step1. stop mysql

    step2. sudo mysqld_safe --skip-grant-tables

    step3.mysql -u root

    step4.use mysql;

    step5.show tables;

    step6.describe user;

    step7.update user set authentication_string=password('1111') where user='root';

    login with password 1111

    0 讨论(0)
  • 2020-11-29 19:02
    SET PASSWORD FOR 'root'@'localhost' = PASSWORD('mypass');
    FLUSH PRIVILEGES;
    
    0 讨论(0)
提交回复
热议问题