after doing a successful Export generating 98.1MB .sql file
when performing import/restore this is what logs shows
MySql.Data.MySqlClient.MySqlException (0x80004005): Packets larger than max_allowed_packet are not allowed.
at MySql.Data.MySqlClient.MySqlStream.SendPacket(MySqlPacket packet)
at MySql.Data.MySqlClient.NativeDriver.ExecutePacket(MySqlPacket packetToExecute)
at MySql.Data.MySqlClient.NativeDriver.SendQuery(MySqlPacket queryPacket)
at MySql.Data.MySqlClient.Driver.SendQuery(MySqlPacket p)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlBackup.Import_AppendLineAndExecute(String line) in ...\MySqlBackup\MySqlBackup.cs:line 1209
at MySql.Data.MySqlClient.MySqlBackup.Import_ProcessLine(String line) in ...\MySqlBackup\MySqlBackup.cs:line 1116
at MySql.Data.MySqlClient.MySqlBackup.Import_Start() in ...\MySqlBackup\MySqlBackup.cs:line 1010
i think you want client to resolve this!! isnt it ..
max_allowed_packet on my MySql server
I am saying this because, you think you are smarter than other...
stop thinking that and kindly check your code for bugs
prepare export code in such a way that does not create issue while importing
an exported Sql becomes useless when not able to import for any reason.
Solution to this is
read max_allowed_packet variable from database in your code and
use that while exporting if user does not specify other size
I am sorry for the hard words that I have written above.
My sincere apologize for this.
Back to the issue, you have stated 2 problems:
Issue 1: MySql DateTime data type to .NET parsing error
Issue 2: max_allowed_packet problems
I will recheck the DataType parsing code and do some more test again with different condition.
Your suggestion is good.
Maybe I will put a boolean value at ExportInfo, something like:
ExportInfo.UseServerMaxAllowedPacket = true;
Default value is
which mean, if true, automatic retrieve value of max_allow_packet from server and apply it.
And this ExportInfo.UseServerMaxAllowedPacket will be overrided to false if the user manually specify the value of:
Thanks for the info and suggestion provided. It is very helpful.
I've been working on my own sql dump utility independently and ran into a snag. So I've been scouring the web for code that converts a binary field into a string. My goal is to do it the way that tools like SqlYog does it. When I found this project of yours I hoped it might contain some code that does it but I see that you are taking an approach similar to what I was initially doing which is to generate a hex string for the binary. This of course works great for short binary fields but for longer ones it's not space efficient since each byte in the binary field will be output as two hex string chars. Alternately, SqlYog exports the binary field as a string which can be much more space efficient. So for example if a binary field holds 0x00000000007D3582 SqlYog will export this as this string '\0\0\0\0\0}5‚' For my sqldump tool I'd like to take this same approach. Any idea how once could do that in C#? PS: I know this question isn't about your MySqlBackup.Net project exactly, but I thought you might find it interesting given we are working on similar projects. Also the answer would be useful for your project too.
It works, the changing part... more or less.There is something tricky about totalrowsinalltables and currentrowofalltables.... current row goes bigger than totalrows... but, well ill check out that.
But there is a problem with the complete event. it gives:
Error 3 El método 'Private Sub mb_Exportcomplete(sender As Object, e As MySql.Data.MySqlClient.ExportCompleteArgs)' doenst have a compatible signature with delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.
weird isnt it?
cmd.Connection = conn_2
mb.ExportInfo.AddCreateDatabase = True
mb.ExportInfo.ExportTableStructure = True
mb.ExportInfo.ExportRows = True
mb.ExportInfo.IntervalForProgressReport = 50AddHandler mb.ExportProgressChanged, New EventHandler(AddressOf mb_ExportProgressChanged)
AddHandler mb.ExportCompleted, New EventHandler(AddressOf mb_Exportcomplete)
PrivateSub mb_Exportcomplete(sender AsObject, e As ExportCompleteArgs)
'here just to test it compliesEndSub
I am using the export functionality with progress bar to show the progress of the export process. Currently, I am setting my progressBar.Maximum with value from (int)e.TotalRowsInAllTables. However, this is not exactly accurate because (int)e.TotalRowsInAllTable is giving me the total number of rows from all tables in the database. But I only need the total number of rows from the tables to be exported (which are the tables found in TablesToBeExportedList). Likewise, (int)e.CurrentRowIndexInAllTables is index from total of rows from all tables in the database, and I only need index from total of rows from all selected tables. Is there a functionality to get these values?
1) Does this create a sql file exactly same as you would used MySqlDump?
Mostly yes, the differences so far that I know:
1. MySqlDump export "Inserts" in single line, but MySqlBackup.NET splits it into multiple lines.
2. MySqlDump export binary in char format, but MySqlBackup.NET export binary in hex string.
2) Can you restore it manually through e.g. phpMyAdmin
Yes, it can be restored manually through phyMyAdmin and MySqlDump.
Even dump files created by phyMyAdmin and MySqlDump can be used in MySqlBackup.NET.
They are all compatible with each other.
Hi, there is a bug in version 2.0.9.
An error will occur where in an unknown condition the value of "TALBE_ROWS" from `information_schema`.`tables` will return as DBNULL and resulting value conversion error to System.Int64.
Last Visit: 31-Dec-99 19:00 Last Update: 25-Feb-24 21:53