Categories
pengkalan data

ekstrak grant privilege mysql

Sumber:

mysql -uroot -p -sNe"`mysql -uroot -p -se"SELECT CONCAT('SHOW GRANTS FOR \'',user,'\'@\'',host,'\';') FROM mysql.user;"`" > grants.sql

Destinasi:

Tambah semicolon pada end of line
awk '{print $0";"}' grants.sql > grants2.sql

Eksport
mysql -uroot -p < grants2.sql