Hi, monks!

I need to upload dump file to remote MySQL server from client machine. So i can't execute mysqldump command on remote server course i just connect to it's 3306 port :-(

All i have is MySQL user password for remote MySQL server and MySQL dump file created via PHPMyAdmin. Here is example of the dump:

/*!40101 SET SQL_MODE=''*/; create database if not exists `nexusscars`; USE `nexusscars`; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY +_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO +' */; /*Table structure for table `bids` */ DROP TABLE IF EXISTS `bids`; CREATE TABLE `bids` ( `id` int(11) NOT NULL auto_increment, `site_id` int(11) NOT NULL, `target` int(11) NOT NULL, `bid_num` int(11) NOT NULL, `model_id` int(11) NOT NULL, `body` varchar(50) default NULL, `color_id` int(11) NOT NULL, `year` int(11) NOT NULL, `mileage` int(11) default NULL, `transmission` varchar(10) NOT NULL, `displacement` int(11) default NULL, `grade` varchar(50) default NULL, `inspection` varchar(50) default NULL, `score_id` int(11) NOT NULL, `trade_date` date NOT NULL, `start` int(11) default NULL, `final` int(11) default NULL, `result_id` int(11) NOT NULL, `front_image` tinyint(1) default NULL, `back_image` tinyint(1) default NULL, `auction_list_image` tinyint(1) default NULL, `aircondition` tinyint(1) default NULL, `powerwindow` tinyint(1) default NULL, `powersteering` tinyint(1) default NULL, `aluminiumwheels` tinyint(1) default NULL, `sunroof` tinyint(1) default NULL, `leather` tinyint(1) default NULL, `tv` tinyint(1) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Data for the table `sites` */ insert into `sites`(`id`,`name`,`kaijo`,`day_of_week`,`delivery_price +`,`image_field_size`) values (70,'Ryuutsu','RA',7,0,5),(71,'Sapporo', +'SP',4,25000,5),(72,'Gunma','GM',7,0,4),(73,'R_Nagoya','NR',2,20000,5 +),(74,'Yokohama','YK',3,0,5),(75,'Kobe','KB',3,20000,5),(76,'Tohoku', +'TH',4,25000,4),(77,'Fukuoka','KF',4,50000,4),(78,'Tokyo','TK',5,0,5) +,(79,'R_Tokyo','TR',5,0,5),(80,'Nishi Tokyo','WT',6,0,4),(81,'Nagoya' +,'NG',6,20000,5),(82,'Osaka','OS',6,20000,5),(83,'Shizuoka','SZ',7,20 +000,5),(84,'Okayama','OK',7,40000,4),(85,'Kyushu','KG',7,50000,5),(86 +,'Hokuriku','HK',6,50000,5),(87,'BCN','BC',3,0,5),(88,'Niigata','NT', +4,0,5),(89,'Ju Hiroshima','JH',0,5,0),(90,'LAA Kansai','LK',5,0,5),(9 +1,'BCN','BC',0,0,5),(92,'JU Nagano','JN',3,0,5),(93,'ZiP Osaka','ZO', +5,0,5),(94,'Hanaten','HM',0,0,5),(95,'JU Gifu','JG',0,0,5),(96,'JU Ai +chi','JA',0,0,5),(97,'BAY AUC','BA',4,0,5),(98,'KCAA Fukuoka','KCAA', +0,5,0); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;

I think about parsing SQL and executing it via $dbh->do(). What you think about this? I'm looking into SQL::Statement now but can't find a way how it can help me...

So my main question now is there any modules that can parse SQL dump file into single SQL commands (so i can execute it via DBI)?


In reply to Importing MySQL dump file remotely by Gangabass

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.