Reputation: 45
I am trying to run
GRANT ALL PRIVILEGES ON * . * TO 'root'@'localhost';
from a remote server to localhost/phpmyadmin but getting ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: NO).
mysql> show grants;
+----------------------------------+
| Grants for root@% |
+----------------------------------+
| GRANT USAGE ON *.* TO 'root'@'%' |
+----------------------------------+
How can I resolve this problem? I have gone through a lot of suggestions over internet but can't actually figure out.
Upvotes: 2
Views: 4151
Reputation: 6791
I think, you forgot to flush privileges
.
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' with GRANT OPTION;
mysql> FLUSH PRIVILEGES;
Note:
I have included with GRANT OPTION
because as doc says:
The
GRANT OPTION
privilege enables you to give to other users or remove from other users those privileges that you yourself possess.
Edit 1:
Depending on comments, seems like you have forgotten the root
password. So try to reset like this:
Stop the MySQL Server.
sudo /etc/init.d/mysql stop
Start the mysql without password
sudo mysqld_safe --skip-grant-tables &
Login to mysql
as root
:
mysql -u root
Set new password to root
UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
Flush privileges.
FLUSH PRIVILEGES;
Finally, restart mysql normally.
Upvotes: 3
Reputation: 38
If you have root credential , then Set the privileges like mentioned below.
grant all privileges on db.* to user@'%' identified by 'pass';
Thanks
Upvotes: 0