473,699 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Restoring MySQL dump

2 New Member
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
2 2648
cheesecake
1 New Member
Hello ))) you can also try to use the recovery services . like for example mysql recovery .
Jan 31 '18 #2
lusitanooo
2 New Member
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
1832
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 `--max_allowed_packet=16M' and it doesnt seem to dump anything, I have tried various options, and usually use my db back up script but that doesnt seem to work as well.
6
14504
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> items < c:\bookings\items.mtsql ERROR: Unknown command '\b'. ERROR: Unknown command '\i'. Does anyone know what this means?
2
1698
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
3693
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 that starting on 4/25/2006 the dump files are empty and only shows a few lines of comments or something instead of creating a normal dump as it had been doing just fine for the last few weeks. Quote:
4
3618
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
3252
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 anyone help me in this issue? Does it happen due to version mismatch? how do i take the dump so that when i restore it, the oids are also available? Thanks, Ntech
1
2552
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 have a script with the create table statements etc. If I execute this script in OS400 I get all kind of errors refering to incorrect field types, incorrect intial values etc. Anyone has an idea of conversion programs, or something which can help me...
0
1173
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 have so I have a script with the create table statements etc. If I execute this script in OS400 I get all kind of errors refering to incorrect field types, incorrect intial values etc. Anyone has an idea of conversion programs, or something which can...
0
2349
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 restored but the functions are not restored? Please help me. Ntech
1
2678
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 that the unwanted tags or lines like the mysql comments needs to be ignored and only the actual sql queries should run. How do i do it? May be this is not very clear. Well, i have a database which needs to be updated in every 3 or 6 months for...
0
8704
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8623
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9187
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9053
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8894
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3071
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.