First of, I can't imagine the reason why you've deleted root
user. But back to the question - you should specify WITH GRANT OPTION
, like this:
(However this should be opted after you get the mysql re-installed as if you don't have the root
access and the user is not having the sufficient privileges also, then the best is to restart the install process and make the user and grant them privileges the way defined below)
mysql> create user 'golden'@'localhost' identified by 'password'; Query OK, 0 rows affected (0.00 sec) mysql> grant all privileges on *.* to golden@localhost with 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 all privileges on testing.* to 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.