Home > Database > Mysql Tutorial > How to Reset Your MySQL Root Password on FreeBSD 8.1?

How to Reset Your MySQL Root Password on FreeBSD 8.1?

Susan Sarandon
Release: 2024-12-21 00:59:09
Original
746 people have browsed it

How to Reset Your MySQL Root Password on FreeBSD 8.1?

Resetting MySQL Root Password on FreeBSD 8.1

A common issue with MySQL databases is forgetting the root password, preventing access to the database. This article addresses this problem specifically on FreeBSD 8.1, providing a step-by-step solution.

The error "1045 - Access denied for user 'root' @ 'localhost' (using password: NO)" indicates that the root user is denied access due to an incorrect password. To resolve this, follow these steps:

  1. Stop MySQL: Run the command sudo stop mysql to halt the MySQL service.
  2. Start MySQL in Safe Mode: Enter the command sudo mysqld --skip-grant-tables --skip-networking to start MySQL in a mode that bypasses user authentication.
  3. Connect to MySQL: Open a MySQL terminal by typing mysql.
  4. Update the Root Password: Execute the query update mysql.user set password = password('your_new_password') where user = 'root'; to change the root user's password.
  5. Flush Privileges: Run the command flush privileges; to apply the new password.
  6. Exit MySQL: Type exit; to close the MySQL terminal.
  7. Shut Down MySQL: Enter the command sudo mysqladmin shutdown to stop the MySQL service.
  8. Restart MySQL: Execute the command sudo start mysql to restart MySQL with the new password.

The above is the detailed content of How to Reset Your MySQL Root Password on FreeBSD 8.1?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template