Monday, July 18, 2011

Create USER

Create a user for localhost

CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'password';

--- Give all privileges to user
GRANT ALL PRIVILEGES ON *.* TO 'user_name'@'localhost' WITH GRANT OPTION;

-- grant all operation on a database to user

GRANT ALL ON db_name.* TO 'user_name'@'localhost';


Create a user for other remote hosts


CREATE USER 'user_name'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' WITH GRANT OPTION;