You don't need to move anything. Let the MySQL engine deal with the db files.
In tutorials there is the answer to your question.
Check Reading from a database for details.
If you've read Dubois's book, I wonder what you'd need more, but here goes: (untested)
#!/usr/bin/perl -w use strict; use DBI; my $database = 'test'; my $username = 'username'; my $password = 'secret'; my $dbh=DBI->connect("dbi:mysql:$database", $username,$password, {RaiseError=>1}) or die "can't\n"; #if you get this far, you're connected # and you can list the tables in your db print "$_\n" for $dbh->tables; $dbh->disconnect();
Update
Did you set a user and password in MySQL, or are you running as root without a password? (default out-od-the box).
If that's the case, you should authorize a new user with a password:
use mysql; set password=password('rootpassword'); update user set password=password('rootpassword') where user='root'; delete from user where password=''; grant all privileges on testdatabase.* to kiat identified by 'yourpassword'; flush privileges;
Then log in as 'kiat' (mysql -u kiat -p) and you should be able to use that db, and also the script should work.
For more info, see the appropriate docs.
In reply to Re: Using mysql with perl
by rnahi
in thread Using mysql with perl
by kiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |