0

I cannot seem to push information up into my database via Terminal. MySQL logic is proper, and it acts like the dump was successful. However, the data never gets pushed up into the DB. I'm even logged in as root, which has all permissions on the server and inside of MySQL.

(Edit) My command is:

 mysqldump -u root -p DBNAME db_table < /home/MJV/.../.../db_table_backup.sql

It gives:

-- Dump completed on 2016-07-15 15:22:19

Any advice on how to proceed? Thank you!

Edit: Giacomo1968 told me to run the following command:

mysql -uroot -p[password] dbname db_table </home/MJV/.../.../db_table_backup.sql

Any it threw the help information, such as:

mysql Ver 14.14 Distrib 5.5.49, for debian-linux-gnu (x86_64) using readline 6.3 Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Any more tricks I could be overlooking?

2
  • I don't see any error message relating to a permission issue. We also don't know what's inside db_table_backup.sql, so I find it hard to advice. One thing which strikes me is the parameters dbname and db_table . I didn't work so often with mysql, but why do you want to specify the name of the database and the name of a certain table, when you want to recreate everything from your backup? The SQL code should contain the necessary CREATE commands to perform this task. Jul 29, 2022 at 7:52
  • BTW, why is this tagged terminal? I don't see how this is related to your terminal program, and you did not even mention, which terminal you are using, so you don't seem to consider this important either. Jul 29, 2022 at 7:54

2 Answers 2

0

Your command is:

mysqldump -u root -p DBNAME db_table < /home/MJV/.../.../db_table_backup.sql

mysqldump is just a utility that will dump a MySQL database. You will never be able to import data into a MySQL database using mysqldump. Instead, you should just use the regular mysql command like this:

mysql -uroot -p[password] db_table </home/MJV/.../.../db_table_backup.sql

Of course replace [password] with your actual password but the overall syntax is what you are looking for.

3
  • Hi JakeGould, I tried what you had suggested, and it threw the "help" information for Oracle MySQL, such as the commands. It doesn't go through? Any more advice?
    – MJV
    Jul 15, 2016 at 15:38
  • When you added the password to the command, did you do it directly—with no space—between the -p and the password like this -p[password] or did you just add a space between the -p and the password like this -p [password]? The command should work without the space like this : -p[password]. More details on how to do this on this Stack Overflow answer. Jul 16, 2016 at 16:58
  • It was without spaces. The command was slightly off you provided, but it did work. :) Thanks JakeGould!
    – MJV
    Jul 18, 2016 at 14:06
0

The command that worked was slightly off Giacomo1968’s answer:

mysql -u root -p DBNAME < /home/MJV/.../.../db_table_backup.sql

If anyone can comment the difference between how these execute, I am sure people newer to Linux would appreciate the description.

Thanks everyone!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .