free mysql login and change your password secret

(1) stop the mysql service

      /etc/init.d/mysqld   stop

(2) Password Authentication skipped

      mysqld_safe  --skip-grant-tables  &

(3) Log database

        mysql 

(4) use mysql database

    use mysql

(5) update the user password

    Older MySQL: Update the User the SET password = PASSWORD ( 'new password') where user = 'username'

    The new MySQL: Update the User the SET authentication_string = PASSWORD ( 'new password') where user = 'username'

(6) refresh permission

    flush privileges

(7) out of the database

    quit / exit

(8) to restart the mysql service

    /etc/init.d/mysqld   restart

(9) with a user name to log database

    mysql -u username -p

  PS: If you want to avoid dense login database, the password can be set to null

    

Guess you like

Origin www.cnblogs.com/sgh666/p/01_mysql.html