i googled a lot and i can't found nothing about it !
[root@someday backups]# mysql -u username_1 -p db_1 < tables_to_import/tables.sql ERROR 1050 (42S01) at line 19: Table 'ps_customer' already exists
with mysql -f
is the same. i wish simply import that .sql and rewrite that tables, can someone help me ?
p.s. i know that when you export a db you can choose option "DROP TABLE" but if i have a backup, without this declaration ? how can i force ? Thanks
What you can do is log in to MySQL and drop the tables that you plan to overwrite, then use --force on import.
From the normal command line, you can import the dump file with the following command: mysql -u username -p new_database < data-dump. sql.
To dump entire databases, do not name any tables following db_name , or use the --databases or --all-databases option. To see a list of the options your version of mysqldump supports, issue the command mysqldump --help .
When you do mysqldump add --add-drop-table (like twihoX mentioned). Then do your import as usual. So something like:
mysqldump --add-drop-table -u user -p db_1 > dumpfile.sql mysql -u user -p db_1 < dumpfile.sql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With