mysqlwordpressmysql-error-1045

Access denied for user 'root@localhost' (using password:NO)


I'm trying to run WordPress in my Windows desktop and it needs MySQL.

I install everything with Web Platform Installer which is provided by Microsoft. I never set a root password for MySQL and in the final step of installing WordPress, it asks for a MySQL server password.

What is the default password for root (if there is one) and how to change it?

I tried:

mysql -u root password '123'

But it shows me:

Access denied for user 'root@localhost' (using password:NO)

After this I try:

mysql -u root -p

However, it asks for a password which I don't have.


Update: as Bozho suggested, I did the following:

  1. I stopped the MySQL Service from Windows services

  2. Opened CMD

  3. Changed the location to c:\program files\mysql\bin

  4. Executed the command below

    mysqld --defaults-file="C:\\program files\\mysql\\mysql server 5.1\\my.ini" --init-files=C:\\root.txt

  5. The command ran with a warning about character set which I mentioned below

  6. I start the MySQL service from Windows services

  7. I write in the command line

    mysql -u root -p EnterPassword: 123 // 123 was the password

  8. The command line shows the following error

    Access denied for user 'root@localhost' (using password:**YES**)

How do I solve this?


Solution

  • You can reset your root password. Have in mind that it is not advisable to use root without password.