ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Causes of Access Denied:
1. Make sure that the server is running. If it is not, clients cannot connect to it.
2. It might be that the server is running, but you are trying to connect using a TCP/IP port, named pipe, or Unix socket file different from the one on which the server is listening. To correct this when you invoke a client program, specify a --port option to indicate the proper port number, or a --socket
option to indicate the proper named pipe or Unix socket file. To find out where the socket file is, you can use this command:


shell> netstat -ln | grep mysql

There is many more reasons, which are enlisted on the MySql site

Solution: You can easily override this problem by using the following commands on the terminal.



# /etc/init.d/mysql stop
# mysqld --skip-grant-tables --user=root&
# mysql
mysql> use mysql
mysql> update user set Password='' where User='root';
mysql> exit
# killall -9 mysqld
# /etc/init.d/mysql start
# mysql -p
Enter password:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword');
mysql> FLUSH PRIVILEGES;
mysql> exit

This will flush out all the previlage and set a new root password.

Followers

FeedCount

Latest Posts

thecoderinc

Subscribe Now