Gangabass has asked for the wisdom of the Perl Monks concerning the following question:
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)?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Importing MySQL dump file remotely
by igelkott (Priest) on Aug 09, 2008 at 08:57 UTC | |
|
Re: Importing MySQL dump file remotely
by Corion (Patriarch) on Aug 09, 2008 at 08:40 UTC | |
|
Re: Importing MySQL dump file remotely
by pjotrik (Friar) on Aug 09, 2008 at 12:10 UTC | |
by Lawliet (Curate) on Aug 09, 2008 at 12:14 UTC |