Can't reset root password with --skip-grant-tables on ubuntu 16

后端 未结 4 1749
臣服心动
臣服心动 2020-12-12 12:42

I am trying to reset the root password following MysqlPasswordReset but when I try to start the server with --skip-grant-tables the server doesn\'t start

  • Ubunt
4条回答
  •  孤街浪徒
    2020-12-12 13:16

    For Ubuntu 19 with MySQL 8.0.17-0ubuntu2, what ended up working for me was a combination of many answers:

    1. In the MySQL's configuration file (/etc/mysql/mysql.conf.d/mysqld.cnf on my machine), under [mysqld], add:

      skip-grant-tables = 1 plugin-load-add = auth_socket.so

    2. Restart the MySQL Service;

    3. Connect to MySQL: mysql -uroot;

    4. Run:

    UPDATE mysql.user SET authentication_string=null WHERE User='root';
    FLUSH PRIVILEGES;
    
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'pass123';
    
    1. Stop MySQL and comment skip-grant-tables in the configuration file;

    2. Start MySQL again and this should now work: mysql -u root -ppass123.

提交回复
热议问题