0

I am using the following Batch script.

It generates a .sql file with same size as the one i get when i manually use the mysqldump command from the command line.

However, when i try to load this .sql to a database using :

mysql -u root -p db < file.sql

It does not load anything, no db tables/files are created. Is there an error in the script? or am i missing something?

6
  • That script creates a zip file compressed with 7-zip, how could you load it? Commented Jul 28, 2012 at 21:32
  • i use 7-zip to unzip archive, then this is how i get the .sql file. Commented Jul 28, 2012 at 21:36
  • i will change the feature of this script to create directly .sql file instead of zip, but for now i am unzipping manually. Commented Jul 28, 2012 at 21:37
  • You should try to load the SQL in some kind of management tool and try to execute from there. Usually these tools gives a nice hint of what is wrong. Sorry, but I am not a mysql expert (Still using the old MySql Query Browser). Commented Jul 28, 2012 at 21:42
  • @Steve i fixed it, if you want check my answer provided below. Commented Jul 28, 2012 at 22:51

1 Answer 1

1

For anyone in the same situation, here is what i did and it worked:

I replaced the line:

set mysql_path="......\bin"

By:

set mysql_path="......\bin\mysqldump"


And the line:

%mysql_path%\mysqldump.exe --user %mysql_username% --password=%mysql_password% 
--all-databases --opt > "%output_path%\%date%_%time%.sql"

By:

%mysql_path% -u %mysql_username% -p%mysql_password% %dbname% >
%output_path%\%date_time%.sql

And now it is working.
I do not really know why it didn't work using the previous method, if you know why feel free to comment so we can all understand.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.