Simple Method to Set Up a Databse on a Server - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Simple Method to Set Up a Databse on a Server (/showthread.php?tid=20246) |
Simple Method to Set Up a Databse on a Server - El Forum - 07-02-2009 [eluser]crispinatari[/eluser] Alright so i'm having a little trouble understanding how i set up my SQL dump to work on a proper server, i can get it working using my localhost easily but thats all automated using directory (/bin/data/database/)...which uses (.frm), (.MYD), (.MYI) as opposed to an sql Dump text file. these are all easily configured using WAMP and a program like sqlYog. on a school server i log in and place my code igniter folder into the public directory so it can be viewed and the SQL dump also lives in that directory .... also i have 5 tables in the one SQL dump, should they be seperate instead?? the way i've been accessing my database on the localhost is like this: controller Code: function index() model Code: function get_all_emps() { database: Code: $db['default']['hostname'] = "localhost"; so i'm assuming that the sql file has to be accessed differently once on the school server, so i have to use something like: Code: $conn = mysqli_connect($host, $user, $password) or die("Cannot make connection"); yeh so i'm really confused because there seems to be many ways to go about doing this as opposed to a simple direct way of accessing an sql file on a server... yes im confused, any tips? i'm very new to sql and php as well. sql file is this: Code: DROP TABLE IF EXISTS `tblcourse`; Simple Method to Set Up a Databse on a Server - El Forum - 07-03-2009 [eluser]kgill[/eluser] You're misusing some terms so maybe I'm reading things wrong but it looks like you're confused on the concept of a dump file, your database isn't accessed from the dump file, the database only resides in the MySQL server. There is no setting up involved in a dump file, all a dump file is - is the statements you'd have to type from a mysql command line to create a copy of the dumped database somewhere else. To use it you execute the script in mysql which then runs all those commands in the file and you end up with the tables and data re-created. I'm guessing you have command line access to the school server instead of a GUI and that's what's throwing you off, you need to log into your account on the server, from the same directory as your dump file you then log in to mysql, once you're sitting at the mysql command line type: source yourdumpfilename.sql; That will run the script, after that's done running quit out of mysql and delete the dump file (no sense in keeping it once the data's been loaded into the DB server). Things to note here would be that your school server is probably shared with other classmates so you need to find out how and where you're supposed to put things because if you all share one DB and someone has the same table names as you, you'll wipe out their data and replace it with yours. - K |