MySQL on Windows Access denied for user ‘root’@'localhost’ (using password: NO)
I use MySQL 5.1 ‘on localhost’ commonly for wordpress development. Today started new project and attempted to design database using MySQL Control Center, Navicat, command line mysql client and all time get this fucking annoying
Access denied for user ‘root’@'localhost’ (using password: NO)
Who is fault? No matter. Probably, because of my root user doesn’t have password.
What to do? Finally i did next:
1. Stopped mysql server: i simply found mysqld process in windows task manager and stopped it.
2. Created init.txt file with next content:
UPDATE mysql.user SET Password=PASSWORD(‘mypassword’) WHERE User=’root’;
FLUSH PRIVILEGES;
grant all privileges on *.* to root@localhost identified by ‘mypassword’ with grant option;
grant all privileges on mydatabase.* to root@localhost identified by ‘mypassword’ with grant option;
3. Run mysql server from command line as:
mysqld –init-file=F:\mysql\bin\init.txt
voila
Related posts:























