Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Joseph Wagner
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Joseph Wagner
Android Development Techdegree Graduate 27,137 Points

Upload MySQL DB to Server

Hi!

I'm just finishing up the PHP course, I was wondering how I upload the database to my server from Workbench? I'm using Godaddy.

I see the option to export, and also adding a new connection, but I'm confused what I do first.

Do I first create a new DB in Cpanel and upload, or just create a new connection to my server through workbench? I tried connecting it using my ftp username and password but it wouldn't connect.

I already have one DB installed which is a wordpress database auto installed from quick Wordpress installation.

Any help greatly appreciated!

3 Answers

Petros Sordinas
Petros Sordinas
16,181 Points

Your ftp user name and password have nothing to do with DB connections. I'm not sure what kind of access goDaddy allows to create databases, but considering it is a shared hosting platform I think the easiest option is to create the database via the godaddy control panel and then use phpMyAdmin to export and import your database, so:

On your computer If you have MAMP or WAMP installed, you should have access to phpMyAdmin via the MAMP (or WAMP) start page. Access it and select your database.

  • Go to the export tab
  • Select Custom export method
  • Select all tables (they should be pre selected)
  • Set Output to view as text (you can save to file but it will be simpler to copy and paste)
  • Format SQL
  • In format specific options select structure (and / or data if you want to transfer your existing db data)
  • Tick Create table options & auto_increment
  • Leave the remaining options as they are and click on Go at the bottom of the screen The export script will be displayed on the next screen. Copy that and

On your GoDaddy cpanel, go to phpMyAdmin (after you have created the DB via cPanel)

  • Click on your database (should be empty)
  • Go to the SQL panel
  • Copy the pasted script from before
  • Press GO ... and you should have tables (and or data if selected) in your godaddy DB.

Of course, you could also select to have the export script saved to a file and then used the import tab to upload it on goDaddy phpMyAdmin...

Hope this helps!

Joseph Wagner
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Joseph Wagner
Android Development Techdegree Graduate 27,137 Points

Thanks Petros, I used the phpmyadmin via the Cpanel as you said to create a new database and assign new user rights. I simply used the export function in the Workbench to export the DB into sql format, and then did a simple upload, not too bad actually. Worked great!

Petros Sordinas
Petros Sordinas
16,181 Points

You are welcome :) I just got curious and googled a bit and came up with this http://support.godaddy.com/help/article/4978/connecting-remotely-to-shared-hosting-databases

It probably answers your initial question better. Apparently you can connect to your godaddy mysql db via the workbench, so next time it may be even easier.