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 filesmysqlbin
-
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?
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
You can reset your root password. Have in mind that it is not advisable to use root without password.
1) You can set root password by invoking MySQL console. It is located in
C:wampbinmysqlmysql5.1.53bin
by default.Get to the directory and type MySQL. then set the password as follows..
2) You can configure wamp’s phpmyadmin application for root user by editing
Note :- if you are using xampp then , file will be located at
It looks like this:
The error “Access denied for user ‘root@localhost’ (using password:NO)”
will be resolved when you set
$cfg['Servers'][$i]['AllowNoPassword']
to falseIf you priviously changed the password for ‘root@localhost’, then you have to do 2 things to solve the error “Access denided for user ‘root@localhost'”:
This will resolve the error.
Note: phpmyadmin is a separate tool which comes with wamp.
It just provide a interface to MySQL. if you change my sql root’s password, then you should change the phpmyadmin configurations. Usually phpmyadmin is configured to root user.
Use mysql -u root -p
It will ask for password, insert password and enter.
I was getting the same error on OS X El captain.
Mysql version 5.7 . I was able to connect to mysql with root after executing these steps.
Stop the mysql server
Start mysql in safe mode
Using mysqld, Change the database to mysql and update the details for user ‘root’.
After that kill the ‘mysqld_safe’ process and start mysql normally. You should be able to login to mysql using root and new password. SQL docs for more details
Simply edit
my.ini
file in C:xamppmysqlbin path. Just add:line in between lines of
# The MySQL server [mysqld]
andport=3306
. Then restart the MySQL server.Looks like:
For some information I’ve get error after changing password:
In both cases there was error.
But the thing is after that I’ve tried it with
mysql -uroot -ppassword
instead ofmysql -u root -p password
-> with spaces between -uroot and -ppassword so maybe if someone get trouble can try this way.Make sure the MySQL service is running on your machine, then follow the instructions from MySQL for initially setting up root (search for ‘windows’ and it will take you to the steps for setting up root):
Securing the Initial MySQL Account
Another solution if someone gets the error The specified password for user account ârootâ is not valid, or failed to connect to the database server also with the right password, is the follow
â¢In the Windows registry, delete the mysql_pwd reg key under HKCUSoftwareMicrosoftWebPlatformInstaller
â¢Unistall older version of MySQL .NET connector
â¢Download and install the latest MySql .NET Connector.