Search code examples
mysqlcentos

Mysql command returns no errors and doesn't import the sql file. Why?


I'm executing on a Centos Linux server this command:

mysql -u root -p mydatabase < dump.sql

I enter the password. It seems that all is ok because I absolutely get no errors, no messages that something happened. But sadly, the file is not imported!

Tryed in different ways: -Putting the sql file in another location. -Creating the DB first and than without the DB. -Avoiding the dbname -Adding max_allowed_packet=800M in /etc/my.cnf (because the file is 490mb) -Restarted Mysql. But nothing to do. No errors, no import. I'm stuck and in panic. What to do? ?


Solution

  • If you have already created database then use below steps to import data from .sql file

    DataBase to use:

     use DataBaseName;
    

    Give the source file path

    source /path/to/dump.sql;
    

    Hope this will help