I'm new to MySQL, 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:
- I stopped the MySQL Service from Windows services
- Opened CMD
- Changed the location to c:\program files\mysql\bin
-
Executed the command below
mysqld --defaults-file="C:\\program files\\mysql\\mysql server 5.1\\my.ini" --init-files=C:\\root.txt
-
The command ran with a warning about character set which I mentioned below
- I start the MySQL service from Windows services
-
I write in the command line
mysql -u root -p
EnterPassword: 123 // 123 was the password
-
The command line shows the following error
Access denied for user 'root@localhost' (using password:**YES**)
How do I solve this? I'm waiting to hear from you.
Best Answer
for this kind of error; you just have to set new password to the root user as an admin. follow the steps as follows:
Stop the service/daemon of mysql running
Start mysql without any privileges using the following option; This option is used to boot up and do not use the privilege system of MySQL.
At this moment, the terminal will seem to halt. Let that be, and use new terminal for next steps.
enter the mysql command prompt
Fix the permission setting of the root user ;
*if you don`t want any password or rather an empty password
Confirm the results:
Exit the shell and restart mysql in normal mode.
Now you can successfully login as root user with the password you set