简体   繁体   中英

How can I export a MySQL Database from Cloud9?

How can I export a MySQL Database from Cloud9, the online development IDE in the cloud. I was able to import a database, but I still haven't figured out how to export it, or download it to my computer, or anywhere else for that matter.

I was able to export the database by entering

mysqldump your_database_name > any_file_name.sql

at the cloud9 command line.

mysql-ctl cli
GRANT ALL PRIVILEGES ON *.* TO <username>@localhost;
SHOW VARIABLES LIKE 'socket';
quit;

mysqldump -u<username> --protocol=tcp -S /home/ubuntu/lib/mysql/socket/mysql.sock  --all-databases > db.sql

There were two tricks. First, mysqldump didn't let me run it as the regular root user, so I created my own username with full privileges. Then, I looked up what socket it ran under. Then, I specified that it should run with the tcp protocol. That exported out all my sql tables.

I was getting an error when I tried to import the exported database using the methods above. I found installing phpmyadmin works better when exporting for import to new server database. Here is a post on how to set it up.: https://community.c9.io/t/setting-up-phpmyadmin/1723

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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