cannot grant privileges to mysql database -
i have mysql server version: 5.5.32-0ubuntu0.12.04.1 (ubuntu) installed linux ubuntu 12.04 lts.
i seem have permissions root. can create user , db. however, cannot seem give user permissions db.
my .my.cnf:
[client] user=root password=test i login through mysql -u root -h localhost -p, cannot login without -p option though have .my.cnf (not issue, odd).
there bunch of root users, got rid of them , have these users:
mysql> select host,user,password mysql.user; +-----------+------------------+-------------------------------------------+ | host | user | password | +-----------+------------------+-------------------------------------------+ | localhost | root | ***************************************** | | localhost | debian-sys-maint | ***************************************** | +-----------+------------------+-------------------------------------------+ mysql> show grants 'root'@'localhost'; +----------------------------------------------------------------------------------------------------------------------+ | grants root@localhost | +----------------------------------------------------------------------------------------------------------------------+ | grant privileges on *.* 'root'@'localhost' identified password '*****************************************' | | grant proxy on ''@'' 'root'@'localhost' grant option | +----------------------------------------------------------------------------------------------------------------------+ now, create db, user. last line shows error when grant permissions. can please let me know why getting error , can make work?
mysql> create database staging; query ok, 1 row affected (0.00 sec) mysql> create user 'staging'@'localhost' identified 'test'; query ok, 0 rows affected (0.00 sec) mysql> grant privileges on staging.* 'staging'@'localhost'; error 1044 (42000): access denied user 'root'@'localhost' database 'staging'
first, identify user logged in as:
select user(); select current_user(); the result first command attempted login as, second connected as. confirm logged in root@localhost in mysql.
the issue installation came did not provide grant_priv root@localhost. here how can check.
mysql> select host,user,password,grant_priv,super_priv mysql.user; +-----------+------------------+-------------------------------------------+------------+------------+ | host | user | password | grant_priv | super_priv | +-----------+------------------+-------------------------------------------+------------+------------+ | localhost | root | ***************************************** | n | y | | localhost | debian-sys-maint | ***************************************** | y | y | | localhost | staging | ***************************************** | n | n | +-----------+------------------+-------------------------------------------+------------+------------+ you can see grant_priv set n root@localhost. needs y. here how fixed this:
update mysql.user set grant_priv='y', super_priv='y' user='root'; flush privileges; grant on *.* 'root'@'localhost'; i did permission error, when logged in, fine.
Comments
Post a Comment