I Installed MySQL on my CentOS 6.4 server. I logged into my root and changed its password.
Later I thought that I should make a new user and use that user as my default user, So I created a new user name golden
using the following command:
CREATE USER 'golden'@'%' IDENTIFIED BY 'password';
Then I applied permission to the user golden
:
GRANT ALL PRIVILEGES ON * . * TO 'golden'@'%';
FLUSH PRIVILEGES;
Now this user: golden
was able to do everything. So I finally Deleted the root user
. Now I am stuck up on granting privilege to my one another new user.
I created another user, when I was logged in through golden
(At this time I had already deleted the root
user and command successfully created and the new user I am able to see it in list also)
CREATE USER 'fashion'@'%' IDENTIFIED BY 'password';
Then the following commands below gives me error:
GRANT ALL PRIVILEGES ON *.* TO 'fashion'@'%';
ERROR: ERROR 1045 (28000): Access denied for user 'golden'@'%' (using password: YES)
I also tried the following command the result is below:
mysql> SELECT USER(),CURRENT_USER(); +------------------+----------------+ | USER() | CURRENT_USER() | +------------------+----------------+ | golden@localhost | golden@% | +------------------+----------------+
If I wont be able to give access to this user then how can I login and use the database? Kindly help.
EDIT 1: The following command gives me the following result
mysql> select user, host FROM mysql.user; +------------+-------+ | user | host | +------------+-------+ | golden | % | | fashion | % | +------------+-------+