CodeIgniter Forums
Running a Database on a Live Public Server? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Running a Database on a Live Public Server? (/thread-20345.html)



Running a Database on a Live Public Server? - El Forum - 07-06-2009

[eluser]crispinatari[/eluser]
So just say i'm working with codeigniter and a database that runs on a usb uniserver, where the database usr/bin files are already set up with phpmyadmin and sqlyog, when i transition that site to a live server i dont actually use the uniserver aka eg. (wamp, xamp) folders, its only the CI (Code Ingiter) folder and the database i set up by creating an sql dump until i manage to get the sql dump (of the database i worked on in sqlyog) to work properly through my database on the live server? (just imagine it as a work or school server)

because its taken me all day just to configure the sql dump so it works.

weird thing is when i execute the dump file it changes the sqldump file to mydatabase and piwik and the sql file becomes huge!! ..

so im a little lost on the logic of (A) the transition of localhost database to live server and (b) how the sql dump works and how you execute it to run properly.

Code:
CODE:
cd /home/myhome/public_html

Code:
mysqldump --opt -u dbuser -p dbname> mydbname.sql
password:

Code:
source mydbname.sql

once that is executed how does the dump file of the actual database i want to work with come into the picture? just say i have a website set up in a public_html folder how do i now access and run my EMPLOYEE TABLE.sql?

using an SSH shell command line for instance....


Running a Database on a Live Public Server? - El Forum - 07-07-2009

[eluser]elvix[/eluser]
why not try an export and import through phpmyadmin (assuming you have it set up on the live server)?


Running a Database on a Live Public Server? - El Forum - 07-07-2009

[eluser]Phil Sturgeon[/eluser]
To get it sent to a file use:

Quote:mysqldump --opt -u dbuser -pPASSWORD dbname > /home/someuser/my_backup.sql

Your file is then ready to be SCP/FTPed to your live server. Do this over the command line if you know how or crack open an FTP client and download the file. Then upload it to your live server.

Quote:mysql -u dbuser -pPASSWORD dbname < /home/someuser/my_backup.sql

This method is clearly more complicated than phpMyAdmin but has the added advantage of working with crazy-f**k-huge files.


Running a Database on a Live Public Server? - El Forum - 07-07-2009

[eluser]Dam1an[/eluser]
Just to correct Phil (and it's not his fault per se), that should be
Code:
mysqldump --opt -u dbuser -pPASSWORD dbname > /home/someuser/my_backup.sql
The auto typography for the quote block converts the 2 dashes to --

See here for more on mysqldump