MySQL

MySQL

How to add a new user to MySQL and set privileges

First you need to connect to MySQL server with a user who has administrative priveleges.

[root@techpulp ~]# mysql -u root -p

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.67 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

Let us assume you are creating an user named “neo” with password “neopass“and you would like to grant all privileges on the database “articles“.

mysql> GRANT ALL ON articles.* to 'neo'@'localhost' identified by 'neopass' WITH GRANT OPTION;

After adding a new user, you need More >