Home > Database > Mysql Tutorial > Why Am I Getting a 'Access Denied for User 'root@localhost'' Error in MySQL When Running WordPress?

Why Am I Getting a 'Access Denied for User 'root@localhost'' Error in MySQL When Running WordPress?

Patricia Arquette
Release: 2024-12-20 12:09:09
Original
788 people have browsed it

Why Am I Getting a

MySQL Error: Access Denied for User 'root@localhost'

When attempting to run WordPress on a Windows desktop with MySQL installed, users may encounter the error message "Access denied for user 'root@localhost' (using password:NO)". This occurs when no root password has been set for MySQL during installation.

Default Password for Root

MySQL does not set a default password for the root user. Therefore, there is no default password to use.

Changing the Root Password

To change the root password, follow these steps:

  1. Stop the MySQL service.
  2. Open a Command Prompt window.
  3. Change the directory to c:program filesmysqlbin.
  4. Execute the command: mysqld --defaults-file="C:\program files\mysql\mysql server 5.1\my.ini" --init-files=C:\root.txt
  5. Set a password for the root user.
  6. Start the MySQL service.

Troubleshooting the "Access Denied for User 'root@localhost' (using password:YES)" Error

If you encounter the "Access denied for user 'root@localhost' (using password:YES)" error, try the following:

  1. Stop the MySQL service.
  2. Start MySQL without any privileges using the --skip-grant-tables option.
  3. Enter the MySQL command prompt.
  4. Truncate the user table.
  5. Flush the privileges.
  6. Grant all privileges to the root user with the new password.
  7. Exit the shell and restart MySQL in normal mode.

The above is the detailed content of Why Am I Getting a 'Access Denied for User 'root@localhost'' Error in MySQL When Running WordPress?. 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