Skip to content

MySQL: Add User

To create a database and give a user privilege to that database:

mysql> CREATE DATABASE temp;
mysql> GRANT ALL PRIVILEGES ON temp.* TO 'bob'@'EEEPC'
    -> IDENTIFIED BY 'alice'
    -> WITH GRANT OPTION;

The privilege is full for Bob for all tables contained in the database called temp. Here, I explicitly defined the user’s host. That means Bob can only access the server if he used my Eee-PC. Even local access for Bob is not allowed because I did not add ‘bob’@'localhost’ in the GRANT command.

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*