只備份存儲(chǔ)過(guò)程:
mysqldump --skip-opt -t -d -R -uusername -p dbname >sp_dbname.sql
把存儲(chǔ)過(guò)程和數(shù)據(jù)庫(kù)一起備份:
mysqldump --opt -R -uusername -p dbname >dbname.sql
某用戶(hù)權(quán)限:
grant all on 數(shù)據(jù)庫(kù)名.* to '用戶(hù)名'@'localhost' Identified by "密碼";
GRANT SELECT ON `數(shù)據(jù)庫(kù)名` . * TO '用戶(hù)名'@'localhost';
撤銷(xiāo)某用戶(hù)權(quán)限:
REVOKE ALL PRIVILEGES ON `數(shù)據(jù)庫(kù)名` . * FROM '用戶(hù)名'@'localhost';
修改ROOT密碼:
update user set password=password('123456') where host='localhost' and user='root';
注:如果備份需要加上編碼 --default-character-set=gbk
最后需要刷新變化替代重啟mysql:flush privileges;
發(fā)表評(píng)論