473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Restoring MySQL dump

How to get mysql to comply with all instructions from a file? Ransacked the entire forum, tried everything I could find, but the instructions are not executed.
Here is the code:
Code:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.     /* Connecting, selecting database */
  3.     $link = mysql_connect("localhost", "root", "")
  4.         or die("Could not connect");
  5.     print "Connected successfully";
  6.     mysql_select_db("000") or die("Could not select database");
  7.  
  8. parse_mysql_dump function($url, $ignore errors = false) { 
  9.    $file_content = file($url); 
  10.    //print_r($file_content); 
  11.    $query = ""; 
  12.    foreach($file_content as $sql_line) { 
  13.      $tsl = trim($sql_line); 
  14.           if (($sql_line != "") && (substr($tsl, 0, 2) != "--") && (substr($str, 0, 1) != "#")) { 
  15.        $query .= $sql_line; 
  16.        if(preg_match("/;\s*$/", $sql_line)) { 
  17.          $result = mysql_query($query); 
  18.          if (!$result && !$ignoreerrors) die(mysql_error()); 
  19.          $query = ""; 
  20.        } 
  21.      } 
  22.    } 
  23.   }
  24.  
  25. if(parse_mysql_dump("2.sql")) echo "YES!";
  26. else echo "NO!";
  27. ?>
Jan 29 '18 #1

✓ answered by cheesecake

Hello ))) you can also try to use the recovery services . like for example mysql recovery .

2 2624
Hello ))) you can also try to use the recovery services . like for example mysql recovery .
Jan 31 '18 #2
Hello , now I will try , thanks for the reply , I had never used a recovery service
Jan 31 '18 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: blah | last post by:
Every time I try to do a back up of the databases on our system i get this error: ea990# mysqldump -u root -p --opt -full test > test.sql mysqldump: unrecognized option...
6
by: Daniel Gwynne | last post by:
I am trying to read a mysql dump file that I was given from a mysql dump file into my mysql server, I am using the following command at the mysql command line and get the following error: mysql>...
2
by: mike vidal | last post by:
Is it possible to restore a mysql server if all that you have is the data files. This database uses innodb tables.
4
by: Robert Blackwell | last post by:
A while ago I had some help from here to make a batch file that would dump my db. Everything was working just fine until 2 days ago and I just found out. I checked my backup folder and found...
4
by: prosad | last post by:
hi! my problems: 1. i can not restore my database from my command line i type gives me: /*!40101 SET @OLD_CHARACTER...
1
by: ntech | last post by:
Hello, i am facing a problem. I am using postgresql database in Linux. After taking the dump of any postgresql database, when i restore the dump file into a new database, i dont get any oids. so can...
1
by: renestigter | last post by:
hi all, I am not an SQL expert but have experience with DB2 on the Iseries/AS400. I simply want to generate an SQL database in OS400 DB2. My idea was to create a dump of the MySQL database so I...
0
by: renestigter | last post by:
hi all, I am not an SQL expert but have experience with DB2 on the Iseries/AS400. I simply want to generate an SQL database in OS400 DB2. My idea was to create a dump of the MySQL database I...
0
by: ntech | last post by:
hello, when i took the dump and tried to restore the dump in postgresql 7.3.4, the functions are not restored, so can anyone suggest me the solution of the above specified problem. The oids are...
1
by: raamay | last post by:
I want to run the mysql generated dump values of a database through a textarea in php. I am copying the whole dump code in a textarea and then let the php run the entire code. But here the problem is...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.