After creating a user and giving all privileges to the user, you need to FLUSH PRIVILEGES to set up and want the new settings to work correctly.
The syntax is as follows −
FLUSH PRIVILEGES;
Here is the query to create a new user which has the name ‘Bob’ in my case. The query to create a new user is as follows −
mysql> CREATE USER 'Bob'@'%' IDENTIFIED BY '123456'; Query OK, 0 rows affected (0.56 sec)
Now given all privileges to user Bob −
mysql> GRANT ALL PRIVILEGES ON *.* TO 'Bob'@'%' WITH GRANT OPTION; Query OK, 0 rows affected (0.23 sec)
Now flush the privileges. The query is as follows −
mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.14 sec)
Now here I am using user Bob with password 123456. The snapshot is as follows −