I created a user named 'root', by setting a password for it by using:
create user 'root'@'localhost' identified by 'some_password';
It successfully created a user and I assigned all the privileges to it against a particular database that I created, and was able to connect successfully to that database.
But when I logged in using:
mysql -u root -p
with the password I set in first step and tried performing operations like Create New Database, Select user from mysql.user, and all other operations not related to that particular database against which the permissions are assigned , it is throwing
mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;
ERROR 1142 (42000): SELECT command denied to user 'root'@'localhost' for table 'user'
mysql>
mysql> grant usage on *.* to 'root'@'localhost';
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
mysql> GRANT ALL PRIVILEGES ON * . * TO 'root'@'localhost';
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
mysql> SHOW GRANTS FOR 'root'@'localhost';
+-------------------------------------------------------------+
| Grants for root@localhost |
+-------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'root'@'localhost' |
| GRANT ALL PRIVILEGES ON `navi`.`navi` TO 'root'@'localhost' |
+-------------------------------------------------------------+
2 rows in set (0.00 sec)
mysql> create user 'django'@'localhost' identified by 'django-user-password';
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
mysql> flush privileges;
ERROR 1227 (42000): Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
mysql> FLUSH PRIVILEGES;
ERROR 1227 (42000): Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
In my understanding I might have overwritten the root user by creating a new root user. Is there anyway I can login as main root user and not the one that I created? So that I can perform basic MySQL operations.