Ubuntu – Commands to upload database file to database

command linedatabaseMySQL

There is a database file in this path : /var/www/db.sql in server.

Our database size is about 800mb.

we have to upload this sql file to the database : "age"

username : root,
password : pass,
database password : dbpass

i am trying this command . but its not working.

mysql -u root -p pass age db.sql

i followed this link : https://stackoverflow.com/questions/19483087/importing-large-sql-file-to-mysql-via-command-line

please give the correct command

Best Answer

You're shell command is missing the shell redirect input operator: <. This tells mysql to read in the file "db.sql". See https://www.gnu.org/software/bash/manual/html_node/Redirections.html (assuming you're using bash or equivalent).

Try: "mysql -u root -p pass age < db.sql"

Related Question