Forum Moderators: coopster

Message Too Old, No Replies

Php/Mysql- uploading Mysql database

         

onoff

3:13 pm on Jul 29, 2005 (gmt 0)

10+ Year Member



Hi,

OK, firstly let me state I am a total beginner to Mysql and databases (excluding basic Microsoft Access ones).

Anyway, I've set up a basic database using Mysql (just creating a web blog I followed a tutorial) and then started writing the php code for interacting with the database. how do I put the Mysql database onto the the web server where I have server space (the server I use is just some company that I pay €100 a year for). I need the php file to get the data from the Mysql database.

As I said before, I am a total beginner so please excuse my ignorance! I still havn't got my head around the Mysql concept!

Cheers

ergophobe

5:40 pm on Jul 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your host probably has it installed already. If you create a file called info.php that has just one line

<?php phpinfo();?>

and upload it to your server. Then go to http://example.com/info.php where example.com is your domain. This will give you all kinds of information about your server, including whether MySQL is available or not.

Once you get that far, check back in and we'll take it from there.

Cheers and welcome to WebmasterWorld

onoff

6:31 pm on Jul 29, 2005 (gmt 0)

10+ Year Member



Thanks for that! I checked that out and I do indeed have Mysql on the server. How do I go about outting the data I have on the mysql database I have created offline onto the online database that the host has set up

Cheers

jatar_k

6:50 pm on Jul 29, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you will need to export the data

do you have phpmyadmin or any such mysql GUI interface that may be able to do this?

if not, no big deal, all they do is construct and issue the mysqldump command for you. You can read about mysql dump right here
[dev.mysql.com...]

once you have managed to dump the file, we can go from there ;)

and Welcome to WebmasterWorld onoff

onoff

1:23 pm on Jul 30, 2005 (gmt 0)

10+ Year Member



Ok, I've downloaded Navicat and opened my database, dumped the data in SQL format, not sure what to do with the exported sql file though!

Cheers

jatar_k

3:09 pm on Jul 30, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



well now you need to upload it to the new server and import it

I am assuming afew things

that the db does not exist on the new server
that the file has a creat database statement in it
that your file has create table statements in it
then the file has all the insert statements as well

normally I import those files from the command line using something like so

mysql -u username -p < /path/to/dumpfile.sql

it will then prompt for a password and suck the whole file into mysql. If the file is right everything will be created and off you go.

ergophobe

4:07 pm on Jul 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you do not have "shell" access, most shared hosting setups give you management control of your database(s) through PhpMyAdmin, probably from somewhere on your control panel.

Jatar_K's method is really the easiest way - PhpMyAdmin is frustratingly cumbersome. On the other hand, it's total GUI and so it's reasonably intuitive in comparison and it allows uploading .zip files, so depending on your comfort level and your setup, it may be just as fast as opening a shell client and doing it that way. Your call