Gán quyền cho user, host vào
grant all privileges on database.table_name to username@'host' identified by 'password';
List user, host
SELECT User, Host, Password FROM mysql.user;
Xóa bớt user
DROP USER 'user'@'host';
Limit
CREATE USER 'francis'@'localhost' IDENTIFIED BY 'frank'; GRANT ALL ON customer.* TO 'francis'@'localhost' -> WITH MAX_QUERIES_PER_HOUR 20 -> MAX_UPDATES_PER_HOUR 10 -> MAX_CONNECTIONS_PER_HOUR 5 -> MAX_USER_CONNECTIONS 2;
Dump mysql database
mysqldump -uroot -p database > ~/bak/database.sql
Restore mysql database
mysql -uroot -p database < ~/bak/database.sql