DBIx :: Class :: Schema :: Loader connect to db on another machine

I am using DBIx :: Class: Schema :: Loader via command line to generate a schema from my database for DBIx :: Class for my Catalyst application. This is the command I'm using:

script/myapp_create.pl model DB DBIC::Schema myapp::Schema create=static \
components=TimeStamp,PassphraseColumn dbi:mysql:mydb 'root' '' '{ AutoCommit => 1 }'

      

However, this command now doesn't work because my database is on a separate machine. How can I tell which IP to connect with? Thank!

+3


source to share


2 answers


I ended up figuring out how to do it. It seems that if you go through another hash after the last one, that hash will be used for your connection information. So just add this to the end:

'{host=>"ip_here"}'

      



I looked after the problem. Here is the complete command:

script/myapp_create.pl model DB DBIC::Schema myapp::Schema create=static \
components=TimeStamp,PassphraseColumn dbi:mysql:mydb 'root' ''           \
'{ AutoCommit => 1 }' '{host=>"ip_here"}'

      

+2


source


The dbi: mysql: ... parameter is a normal DBI connection string. After the first: the database driver (DBD) appears, after the second parameter DBD. Read the DBD :: mysql documentation to learn how to point to a database on a remote machine.



0


source







All Articles