I use the mysqldump utility to dump the database on the test server, which runs on the crown.
Mysqldump --host = 127.0.0.1 --skip-add-drop-table --skip-add-locks --no-create-info --user = root --password = 'root' stead> tead.sql
On production for import use:
Mysql --user = root --password = 'root' test
It also starts on the crown.
The dump file contains approximately the following information.
INSERT INTO im_gruppy
VALUES (100, 'Paper for office equipment', 1, '100.png', 1);
The problem is that when insert finds Duplicate entry '1' for key 'PRIMARY', import stops. And I would like to update the old records.
Prompt as it is possible by means of mysqldump and mysql to do update lines and if a line is not present that insert?
mysqldump includes all the tables of the database by default. In order to dump only a specific set of tables using mysqldump , you need to specify the database name followed by the name of the tables you want to include in the dump. After running the command from the example above, the output file my_backup.
By default, mysqldump locks all the tables it's about to dump. This ensure the data is in a consistent state during the dump.
When mysqldump is created with –databases or –all-databases option, it will add “CREATE TABLE” and “USE” statements. If you need to restore the dump into different database (different name) you need to remove those statements. For small files it's not a problem - just edit the dump with your favourite text editor.
mysqldump can retrieve and dump table contents row by row, or it can retrieve the entire content from a table and buffer it in memory before dumping it. Buffering in memory can be a problem if you are dumping large tables. To dump tables row by row, use the --quick option (or --opt , which enables --quick ).
mysqldump --host=127.0.0.1 --skip-add-drop-table --skip-add-locks --no-create-info --replace --user=root --password='root' stead > tead.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