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

How to Reset the MySQL Root Password on FreeBSD?

Patricia Arquette
Patricia ArquetteOriginal
2024-12-09 02:59:14685browse

How to Reset the MySQL Root Password on FreeBSD?

Resetting MySQL Root Password on FreeBSD

Accessing your MySQL database with PhpMyAdmin can be hindered if you have accidentally deleted user accounts. The common solution to reset the root password through SQL doesn't work in some cases.

Solution:

  1. Stop MySQL: sudo stop mysql
  2. Start MySQL in safe mode: sudo mysqld --skip-grant-tables --skip-networking
  3. Connect to MySQL: mysql
  4. Reset the root password: update mysql.user set password = password('your_new_password') where user = 'root';
  5. Flush privileges: flush privileges;
  6. Exit MySQL: exit;
  7. Shutdown MySQL: sudo mysqladmin shutdown
  8. Start MySQL: sudo start mysql

Following these steps should allow you to successfully reset your MySQL root password on FreeBSD 8.1.

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

Statement:
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