Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top