I recently backed up a MySQL database in anticipation of a hardware swap out. After installing MySQL on the new hardware I attempted to import the database via MySQL WorkBench. All the tables imported correctly from the complete dump until it hit the Results file – this file contains a number of large BLObs. The preceding Random file which contains smaller BLObs imported correctly. After a number of failures I went to an older dump of individual files with the following result:-
17:35:20 Restoring /media/Week 1/MySQL/Dump20141112/Physio_Results.sql
Running: mysql --defaults-extra-file="/tmp/tmpydQEsK/extraparams.cnf" --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments < "/media/Week 1/MySQL/Dump20141112/Physio_Results.sql"
ERROR 2006 (HY000) at line 51: MySQL server has gone away
Operation failed with exitcode 1
17:35:21 Import of /media/Week 1/MySQL/Dump20141112/Physio_Results.sql has finished with 1 errors
17:36:11 Restoring /media/Week 1/MySQL/Dump20141112/Physio_Session.sql
Running: mysql --defaults-extra-file="/tmp/tmpnAksEb/extraparams.cnf" --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments < "/media/Week 1/MySQL/Dump20141112/Physio_Session.sql"
17:36:12 Import of /media/Week 1/MySQL/Dump20141112/Physio_Session.sql has finished
So obviously the larger BLObs are causing an issue but how do I overcome this? The documentation I looked at only says:-
Error Code: 2006 MySQL server has gone away
which adds nothing!
After increasing maxallowedpacket and netbufferlength I got slightly further, see below. I am unsure where to go next as I seem unable to restore data that I was allowed to export!
16:19:45 Restoring Physio (Results)
Running: mysql --defaults-extra-file="/tmp/tmpyme2U4/extraparams.cnf" --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments < "/home/mjh/Desktop/Dump20141112/Physio_Results.sql"
ERROR 1118 (42000) at line 53: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
Operation failed with exitcode 1
16:19:54 Import of /home/mjh/Desktop/Dump20141112 has finished with 1 errors
Related
I'm trying to import a SQL database with mysql but not all of the rows are imported.
I'm using Ubuntu 17, mysql Ver 14.14, Distrib 5.7.26. First, I'm opening mysql with "mysql -u root -p", then "use db;", then "source [fullpath]/db.sql". Using this I get error message:
ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected
Unfortunately, I check if all tables are imported with "show tables;" and only 2 of 5 tables are imported. Furthermore, not all rows from second table are imported. I'm sure that there must be 5 tables and X number of rows.
To prevent this I used this command:
mysql -u root -p -h localhost -D db --binary-mode -o < [fullpath]/db.sql
But it gives me "ERROR at line 144: Unknown command '\�'."
I've also tried converting database to utf-8 format with this command:
sudo iconv -f utf-16 -t utf-8 db.sql > db_utf8.sql
Then tried using "source" command for "db_utf8.sql" but got this error:
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 42
Current database: db
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 43
Current database: db
ERROR 2006 (HY000): MySQL server has gone away
Please, does someone know what to do.
My coworkers are using the same file and everything is okay for them so maybe I'm not using the correct commands.
Edit: In some questions there are tips about (un)ziping the file but this one was never ziped or unziped.
It works now. I'm lucky that I have a coworker that tried the same and everything was okay. So I mysqldump'ed the database from that computer, moved the .sql file to my computer and tried to import this dumped file. Now everything works fine.
I have 2 different dumps from a prev setup(MySQL 5.xx). The first one is a self-contained file on about 250 MB, the other is a folder with 317 SQL files. Both is dumps from the same setup, just in different formats.
Now I need to restore one of them in the new MySQL 8 setup.
The folder dump contains a total of 10 schemas including sys. The MySQL 8 is just created so there is only a sys schema.
When I run the Import I just get a lot of errors like this:
10:09:24 Restoring myvideos93 (streamdetails) Running: mysql.exe
--defaults-file="c:\users\jimmy\appdata\local\temp\tmpk7oihn.cnf" --protocol=tcp --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments --database=myvideos93 < "F:\20180605
Backup\Documents\dumps\Dump20180605\myvideos93_streamdetails.sql"
ERROR 1049 (42000): Unknown database 'myvideos93'
Operation failed with exitcode 1
I'm doing this from MySQL Workbench on Windows 10 x64.
How to solve it?
Okay, so I hade to create each schema manually, but that was not enouth. I also hade to run the import 3 times until I only got 1 minor error. MySQL Windows components are still surprisingly unstable.
I've acquired a back-up file of my company database in the form of a self contained .sql file. I've set up MYSQL on my Win7 box and am trying to import the data into a schema with the same name as guided by MYSQL help files. It does load some data however not all of it is being imported and I get the following in the Import Progress window of the MySQL Workbench:
10:11:15 Restoring C:\Backup\DB798-2016-Feb-07.sql
Running: mysql.exe --defaults-file="c:\temp\tmp4g_coc.cnf" --protocol=tcp --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments --database=DB798 < "C:\\Backup\\DB798-2016-Feb-07.sql"
ERROR 1265 (01000) at line 11251: Data truncated for column 'social_network' at row 1
Operation failed with exitcode 1
10:12:25 Import of C:\Backup\DB798-2016-Feb-07.sql has finished with 1 errors
I don't care about the data in any table labeled 'social_network' the data I really need is somewhere after that in the import process. Any way I can skip that?
It is being truncated because the column in the table is set to a VARCHAR(integer).
if the integer there is shorter than the text you are importing, it will get truncated.
You either need to increase the length of the varchar, or shorten your text before import.
when I try to import my exported dump file (specifically my database/schema) to other computer, I got this error;
D:\CAPSTONE SYSTEM\MyDataBaseCAPSTONE\Dump20150922\schm_capstonesystem_routines.sql does not contain schema/table information
16:58:55 Restoring schm_capstonesystem (employee_entry)
Running: mysql.exe --defaults-file="c:\users\kc\appdata\local\temp\tmpnowdu_.cnf" --protocol=tcp --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments --database=schm_capstonesystem < "D:\CAPSTONE SYSTEM\MyDataBaseCAPSTONE\Dump20150922\schm_capstonesystem_employee_entry.sql"
ERROR 1049 (42000): Unknown database 'schm_capstonesystem'
Operation failed with exitcode 1
Please help~! :-(
The error is Unknown database. You have to create the database 'schm_capstonesystem' first.
And then run the import of your dump.
In case you don't know how to create the schema as in the answer above:
right Click the left pane under Schema in SQL, click create schema,enter a name for the schema (preferably the same as the db your importing) click apply. Then do the import
I formatted my System (C:)in which my database files are stored unfortunately my database backup have lost.I used recovering tools to recover my database files as dump file.when i tried to restore my dump file its displaying error as i mentioned below,
18:00:34 Restoring E:\pos1.sql
Running: mysql.exe --defaults-file="c:\users\ashfaq\appdata\local\temp\tmpdi5lll.cnf" --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments < "E:\pos1.sql"
ERROR: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: ''.
Operation failed with exitcode 1
18:00:36 Import of E:\pos1.sql has finished with 1 errors
any help will be appreciated...