Nasser Hadjloo Nasser Hadjloo - 1 day ago 5
MySQL Question

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

I'm new to mysql, I'm trying to run Wordpress inmy windows desktop and it need Mysql.

I install everything with

Web Platform Installer
which provided by microsoft. I never seta root password for mysql and in final step of installing wordpressit askfor root password of mysql.

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

I try

mysql -u root password '123'


but it show me

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


after this I try

mysql -u root -p


but it ask for a password which I don't have

Thank you in advance




Update : as Bozho said I did the following

1 - I stoped MySql Service from Windows services
2 - Open CMD
3 - change location to cd c:\program files\mysql\bin
4 - write this command

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

5 - Command run with a warning about characterset which I mentioned below
6 - I start MySql Service from windows services
7 - in command line I write

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

8 - the commandline shows following bug

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


I'm waiting to hear from you.

Answer

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

Comments