Give permission database into existing user

just doing this

GRANT ALL PRIVILEGES ON *.* TO 'new_user'@'%' IDENTIFIED BY 'yoursecretpassword' WITH GRANT OPTION;
Advertisements

Give User Access Specific Database (MySQL)

Ok first we need to create user, login user as root to your MySQL

> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

after create user, create database then give privileges to the user

> CREATE DATABASE new_database;
> GRANT ALL PRIVILEGES ON new_database.* TO 'newuser'@'localhost';

then flush privileges

> FLUSH PRIVILEGES;

OK DONE.

source: https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql