in reply to Using mysql with perl

Thanks all! I got it to work at last. What happened was I didn't start mysql server (I didn't know where to look for it). That was the main problem. But your advice that I needn't move the files was very helpful. That assured me there were fewer problem areas. I found the executable file to start the server and ran the script from the command line. From there, I examined the errors and fixed them. Now it's working fine :)

I've another question. If I created the databases and want to use them for a website, where do I upload these database files to? Because I'm running the http server and mysql server locally, this's not a problem - the databases files are automatically loaded by mysql. But if I've a site hosted somewhere else, where do I upload these files to?

Replies are listed 'Best First'.
Re: Re: Using mysql with perl
by Trimbach (Curate) on Jun 07, 2003 at 14:10 UTC
    This isn't Perl, but here goes...

    An ISP that allows you to use MySQL almost certainly will give you login access to the database server WITHOUT giving you access to the physical location on their server where the database is located. So, you won't be able to "upload the database files" anywhere... the best you'll be able to do is export your data from your local tables into a portable (tab or pipe-delimited format), upload that to your ISP, and then connect to your MySQL account and use SQL like LOAD DATA INFILE to import your table data from the flat file to the ISP's database.

    For more details on how to do this (and, in fact, to learn just about everything there is to know about MySQL) check out the MySQL online manual.

    Gary Blackburn
    Trained Killer

      Another way is to write a small DBI script that connects to both DB's: your local one, and the internet one. The script then reads from your own local, and inserts everything into the other one.

      The advantage is that you can use it anytime once you've written it once, and adjust it to work for any table you like.

        Yes, but remember:
        1. If your local machine is behind a firewall (and, really, whose isn't?) then you have to punch a hole through your local firewall to allow the remote script to connect to your database.
        2. Unless you're using an SSL flavor of MySQL (4.x) or tunneling through SSH, you're transmitting your id, password, and data across an unsecure, unencrypted internet connection. Even if your data is uninteresting, it's not a good idea to let the World know the id and password to your exposed MySQL database.

        Other than that it's a great idea. :-) When dealing with an ISP it's much better just to SCP the data to your ISP, and load it that way.

        Gary Blackburn
        Trained Killer