Một số lệnh hay dùng khi sử dụng MySQL

Ngày 17/09 năm 2018 | Tin mới | Tag:

Gán quyền cho user, host vào MySQL grant all privileges on database.table_name to [email protected]'host' identified by 'password'; 1 grant all privileges on database.table_name to [email protected]'host' identified by 'password'; List user,...

Rate this post

Gán quyền cho user, host vào

MySQL

grant all privileges on database.table_name to [email protected]’host’ identified by ‘password’;

1

grant all privileges on database.table_name to [email protected]’host’ identified by ‘password’;

List user, host

MySQL

SELECT User, Host, Password FROM mysql.user;

1

SELECT User, Host, Password FROM mysql.user;

Xóa bớt user

MySQL

DROP USER ‘user’@’host’;

1

DROP USER ‘user’@’host’;

Limit

MySQL

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;

1234567

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

Shell

mysqldump -uroot -p database > ~/bak/database.sql

1

mysqldump -uroot -p database > ~/bak/database.sql

Restore mysql database

Shell

mysql -uroot -p database < ~/bak/database.sql

1

mysql -uroot -p database < ~/bak/database.sql

 

Có thể bạn quan tâm