Disabling User Authentication


Suppose that somehow you have lost the password for your superuser login and need to reset the password. To set a new password, you need to tell MySQL to restart with user authentication disabled.

To do this, you have to have system administration rights to be able to shut down and restart the mysqld process. After stopping the MySQL server, add skip-grant-tables to your master my.cnf file. Alternatively, start mysqld with the --skip-grant-tables switch.

With MySQL started in this mode, you can connect without a password using simply

mysql u root 

Then you can set a new password for root in the usual way. To begin authenticating users, issue the FLUSH PRIVILEGES statement or restart the MySQL server without skip-grant-tables.


Be aware that while mysqld is running with skip-grant-tables, any user may connect without needing to be authenticated. Therefore, if you ever do need to perform this step, do it as quickly as possible! You can also protect yourself by blocking network access using skip-networking and ensuring that no users are logged into the local machine in order to connect to localhost.

MySQL Phrasebook. Essential Code and Commands
MySQL Phrasebook
ISBN: 0672328399
EAN: 2147483647
Year: 2003
Pages: 130

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net