Chạy lênh mysql từ cmd
Huy Châu - September 28, 2011 -
shell> mysql --user=user_name --password=your_password db_name mysql>Enter the following if the database user already exists.:
GRANT SELECT ON database.* TO user@'localhost';
If you intend to create a brand new user, then run this:
GRANT SELECT ON database.* TO user@'localhost' IDENTIFIED BY 'password';
To enable more options, you would separate them with a comma. So to enable SELECT, INSERT, and DELETE your syntax would look like this:
GRANT SELECT, INSERT, DELETE ON database TO username@'localhost' IDENTIFIED BY 'password';
Once you have given the desired privileges for your user, you will need to run this command within the MySQL command prompt:
FLUSH PRIVILEGES;
To see a list of the privileges that have been granted to a specific user:
select * from mysql.user where User='username';
