Minimum GRANTs needed by mysqldump for dumping a full schema? (TRIGGERs are missing!!)

前端 未结 4 491
日久生厌
日久生厌 2020-12-02 08:15

I have a MySQL user called dump with the following perms:

GRANT USAGE ON *.* TO \'dump\'@\'%\' IDENTIFIED BY ...
GRANT SELECT, LOCK TABLES ON `mysql         


        
4条回答
  •  攒了一身酷
    2020-12-02 08:52

    In addition to Jannes answer, when using mysqldump with --tab option (produces a tab-separated text file for each dumped table), your MySQL user must be granted the FILE privilege as well:

    GRANT FILE ON *.* TO 'dump'@'%';
    

    Official docs reference: https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html#option_mysqldump_tab

    Mentioned in this section:

    This option should be used only when mysqldump is run on the same machine as the mysqld server. Because the server creates *.txt files in the directory that you specify, the directory must be writable by the server and the MySQL account that you use must have the FILE privilege. Because mysqldump creates *.sql in the same directory, it must be writable by your system login account.

提交回复
热议问题