简体   繁体   English

如何从Google Cloud SQL备份存储过程备份?

[英]How to backup stored procedure backup from Google Cloud SQL?

I want to create/export only the stored procedures from my Google Cloud SQL DB. 我只想从我的Google Cloud SQL DB创建/导出存储过程。 I tried several commands on my phpmyadmin(installed on Google App Engine) console but I am consistently facing the error mentioned below. 我在phpmyadmin(安装在Google App Engine上)控制台上尝试了几个命令,但始终遇到下面提到的错误。

List of commands I've tried: 我尝试过的命令列表:

1. mysqldump --routines=true -u root sarda_yogi_mobile > my_database.sql
2. mysqldump --databases database_name [-h instance-ip -u username -p password] \ --hex-blob --default-character-set=utf8 > database_file.sql
3. mysqldump --databases database_name [-h instance-ip -u username -p password] --default-character-set=utf8 > database_file.sql
4. mysqldump --host="127.0.0.1" --user="root" --password="" --routines --triggers --events dbname > my_file.sql

Error Message: 错误信息:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqldump --routines=true -u root db_name > my_database.sql' at line 1

Can anyone point me in the right direction? 谁能指出我正确的方向? Thank You :) 谢谢 :)

Those are commands you need to run on a command line, not via the phpMyAdmin shell. 这些是您需要在命令行而不是通过phpMyAdmin shell运行的命令。

If you want to perform an export from phpMyAdmin, there are some guides available on the web, eg http://www.inmotionhosting.com/support/website/phpmyadmin/export-database-using-phpmyadmin 如果要从phpMyAdmin执行导出,则网上有一些指南,例如http://www.inmotionhosting.com/support/website/phpmyadmin/export-database-using-phpmyadmin

As @Vadim said, you're attempting command-line statements at a SQL shell, which (as you've seen) doesn't work. 正如@Vadim所说的,您正在SQL Shell上尝试命令行语句,如您所见,它不起作用。

To perform a stored procedure export from within phpMyAdmin, go to the "Routines" tab of your database and click "Export" for the routine you wish to export. 要从phpMyAdmin内部执行存储过程导出,请转到数据库的“例程”选项卡,然后为要导出的例程单击“导出”。 You could instead use the checkboxes to select several to export at once, if you prefer. 如果愿意,您可以改为使用复选框一次选择多个导出。

例程对话框

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM