views:

96

answers:

1

Hi,

I have a local database, and all the tables are defined. Eventually I need to publish my data remotely, which I can do easily with PHPmyadmin. Problem however is that my remote host doesn't allow remote SQL connections at all, so writing a script that does a mysqldump and run it through a client (which would've been ideal) won't help me here. Since the schema won't change, but the data will, I need some kind of PHP client that works "reverse".

Edit: I want this as an automated solution, so I don't have to copy/paste the SQL everytime I make a change!

My question is if such a client exists and what would be recommended to use (by experience). I just need an one way trip here, from my local database (Rails) to the remote database (supports PHP), preferable as simple and slick as possible. Thank you for your replies, comments and feedback!

+1  A: 

I believe phpmyadmin has the ability to upload and execute an SQL file, so you can just import a mysqldump via that means.

Amber
Yes, but this requires me to do this manually each change. I am looking for a more 'automated' solution. Worst case, I could write something that could facilitate that, but with my PHP skills it would be most likely a poor man's solution.
Shyam
In that case, you can write a script on the remote side that takes the file as input and passes it to `mysqli_multi_query()`: http://php.net/manual/en/mysqli.multi-query.php - then write a script on the local side that invokes the remote script with the proper SQL content. You'll want to make sure this is secured in some way though so that outsiders can't abuse it to mess with your DB.
Amber
hmmm... I was thinking when to do manually, to use POST with the SQL data (with some authentication key) and load that in as $query and feed it to mysql. I strive for an elegant solution, though.
Shyam