mysql - ERROR 1045 (28000): Access denied for user 'username'@'%' (using password: YES) -


i installed mysql on centos 6.4 server. logged root , changed password.

later thought should make new user , use user default user, created new user name golden using following command:

create user 'golden'@'%' identified 'password'; 

then applied permission user golden:

grant privileges on * . * 'golden'@'%';  flush privileges; 

now user: golden able everything. deleted root user. stuck on granting privilege 1 new user.

i created user, when logged in through golden (at time had deleted root user , command created , new user able see in list also)

create user 'fashion'@'%' identified 'password'; 

then following commands below gives me error:

grant privileges on *.* 'fashion'@'%'; 

error: error 1045 (28000): access denied user 'golden'@'%' (using password: yes)

i tried following command result below:

 mysql> select user(),current_user(); +------------------+----------------+ | user()           | current_user() | +------------------+----------------+ | golden@localhost | golden@%       | +------------------+----------------+ 

if wont able give access user how can login , use database? kindly help.

edit 1: following command gives me following result

 mysql> select user, host mysql.user; +------------+-------+ | user       | host  | +------------+-------+ | golden     | %     | | fashion    | %     | +------------+-------+ 

first of, can't imagine reason why you've deleted root user. question - should specify with grant option, this:

(however should opted after mysql re-installed if don't have root access , user not having sufficient privileges also, best restart install process , make user , grant them privileges way defined below)

 mysql> create user 'golden'@'localhost' identified 'password'; query ok, 0 rows affected (0.00 sec)  mysql> grant privileges on *.* golden@localhost grant option; query ok, 0 rows affected (0.00 sec)  mysql> flush privileges; query ok, 0 rows affected (0.00 sec) 

and then

 mysql> select current_user(); +------------------+ | current_user()   | +------------------+ | golden@localhost | +------------------+ 1 row in set (0.00 sec)  mysql> create database testing; query ok, 1 row affected (0.03 sec)  mysql> grant privileges on testing.* test; query ok, 0 rows affected (0.02 sec)  mysql> drop database testing; query ok, 0 rows affected (0.12 sec) 

-but yet again, think twice before deleting root user.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -