Give permission database into existing user

just doing this

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

Update Value + 15 Days (MySQL)

I want to update value in field tanggal_expire + 15 days

ex:

– table account
– field / column tanggal_expire

tanggal_expire
2016-11-10 into 2016-11-25

log in into your db

> UPDATE account SET tanggal_expire = (tanggal_expire + INTERVAL 15 DAY)

you can add where clause if needed.

source: http://stackoverflow.com/questions/3887509/mysqls-now-1-day

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