Modify the mysql login password just installed under Linux

  1. Use Linux super administrator privileges and
    enter sudo suEnter in the terminal
  2. Enter the database
    • Enter mysql -uroot -pEnter at the terminal
    • You are prompted to enter the password, and press Enter directly in the super administrator state to enter the database
  3. Enter in the database
    • Modify the mysql root user password:grant all privileges on *.* to root@localhost identified by '你要设置的密码';
    • Refresh the cache:flush privileges;
  4. Password reset complete

Note : After
     using this method to modify the default password, there is a chance that it will appear: Use mysql -uroot -p to log in to the database directly with mysql -uroot -p within a few minutes of root privileges (normal accounts do not work), but you will need a password to log in after a few minutes Up.

Guess you like

Origin blog.csdn.net/qq_41490274/article/details/95348239