skip to Main Content

I’ve read a post saying that I would have to use this command below, to dump my sql files

$ mysqldump -u [uname] -p db_name > db_backup.sql

However, my question is, I don’t quite get where the db_backup.sql comes from. Am I suppose to create a file or is it being created as I enter any name for the backup sql?
Also, where can I find the backup.sql at?

More information: I am doing this on Mariadb/phpmyadmin on the xampp shell

2

Answers


  1. Whichever directory you are in when you run that command will have db_backup.sql.

    The statement:

    mysqldump -u user -p db_name generates an output on the terminal screen, assuming you are SSH’ed into the server. Instead of the output written on the screen, you can redirect the output to a file.

    To do that, you use > db_backup.sql after the command.

    If you are in directory /home/hyunjae/backups and run the command:

    $ mysqldump -u [uname] -p db_name > db_backup.sql

    You will see a new file created called db_backup.sql. If there’s already a file with that name, it will be overwritten.

    If you don’t know what directory you are in, you can type pwd for present working directory.

    Login or Signup to reply.
  2. db_backup.sql is automatically generated by the mysqldump command, and is located in the current directory (.) by default. If you need to specify a directory, you can directly specify /path/to/target/db_backup.sql.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search