Google cloud sql instance super privilege error

前端 未结 9 1543
挽巷
挽巷 2021-02-19 06:30

I am very new in Google app engine please help me to solve my problem

I have created one instance in Google cloud sql when I import SQL file then it shows me error like

9条回答
  •  失恋的感觉
    2021-02-19 07:03

    For the use case of copying between databases within the same instance, it seems the only way to do this is using mysqldump, which you have to pass some special flags so that it works without SUPER privileges. This is how I copied from one database to another:

    DB_HOST=...  # set to 127.0.0.1 if using cloud-sql proxy
    DB_USER=...
    DB_PASSWORD=...
    SOURCE_DB=...
    DESTINATION_DB=...
    
    mysqldump --hex-blob --skip-triggers --set-gtid-purged=OFF --column-statistics=0 -h $DB_HOST -u $DB_USER -p"$DB_PASSWORD" $SOURCE_DB \
      | mysql -h $DB_HOST -u $DB_USER -p"$DB_PASSWORD" $DESTINATION_DB
    

    Or if you just want to dump to a local file and do something else with it later:

    mysqldump --hex-blob --skip-triggers --set-gtid-purged=OFF --column-statistics=0 -h $DB_HOST -u $DB_USER -p"$DB_PASSWORD" $SOURCE_DB \
      > $SOURCE_DB.sql
    

    See https://cloud.google.com/sql/docs/mysql/import-export/exporting#export-mysqldump for more info.

提交回复
热议问题