Resetting MySQL root password when current password is not known

前端 未结 6 1515
情歌与酒
情歌与酒 2020-12-01 10:58

I have inherited a server that has mysql installed on it. I don\'t have the mysql password for any user, not even root (although I have the linux root password). Plus, I a

6条回答
  •  不知归路
    2020-12-01 11:44

    `UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root'; FLUSH PRIVILEGES;

    Write the UPDATE and FLUSH statements each on a single line. The UPDATE statement resets the password for all root accounts, and the FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change.`

提交回复
热议问题