Error 1305 when importing sql dump into mySQL Workbench - mysql

I am importing a sql dump file into MySQL workbench and keep getting the error below. Does this mean the rest of the file/records did not import or only the xxx.getRates portion did not?
Will I be missing records from it?
Does anyone know what might be causing this?
01:29:31 Restoring D:\Projects\CustomerName\Customer Files\xxx-2016-Oct-03.sql
Running: mysql.exe --defaults-file="c:\users\admini~1\appdata\local\temp\2\tmpru2fjn.cnf" --protocol=tcp --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments --database=xxx < "D:\Projects\CustomerName\Customer Files\xxx-2016-Oct-03.sql
ERROR 1305 (42000) at line 33522: FUNCTION xxx.getRates does not exist
Operation failed with exitcode 1
01:34:29 Import of D:\Projects\CustomerName\Customer Files\xxx-2016-Oct-03.sql has finished with 1 errors

When using mysqldump, you must explicitly ask for Stored routines to be dumped. The option is --routines if you are running it manually. If you are running it through some app (Workbench), then look for its mechanism:
[ ] Dump Stored Procedures and Functions
[ ] Dump Events
[ ] Dump Triggers

Related

Can't import file dumped by mysqldump

I created a dump from a database that we have on a kube pod as follows:
kubectl exec mysql-0 -n pod-name -- mysqldump -u root -ppass dbname > ~/Desktop/dump.sql
I then try to import this database into my local db by:
mysql ebdb --force -uroot -proot < ~/Desktop/dump.sql
But I keep getting errors as:
ERROR 1064 (42000) at line 4550: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''---\nid: 195\nrestaurant_id: 4330\napi_key: sk_live_wVi93Gt11111puIE\nm' at line 1
I repeated the dumping and importing multiple times with similar errors: syntax problems.
I thought maybe the error has to do with encoding, so I dumped using
kubectl exec mysql-0 -n pod-name -- mysqldump -u root -ppass --default-character-set=utf8 ebdb > ~/Desktop/dump.sql
but still same error.
Any ideas about what might be going wrong here?
p.s: Of course I'm changing the name of the pod and pass here as well as some of the chars in the api key for obvious reasons. Otherwise things are left as is

MYSQL importing dump completed with errors

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

MySQL Data Import Failing With Error -1

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

ERROR 1049 (42000): Unknown database, localized Wordpress database

I'm moving my wordpress website to local for testing purpose.
I encountered the error below when I'm trying to import the .sql that I export from CPanel PHPMyadmin into local MYSQL Workbench.
FYI, I'm using MYSQL Workbench 6.0 and MYSQL Administrator 1.2.17
15:08:07 Restoring C:\Users\abc\Desktop\db.sql
Running: mysql.exe --defaults-extra-file="c:\users\abc\appdata\local\temp\3\tmpdemide.cnf" --host=localhost --user=root --port=3307 --default-character-set=utf8 --comments --database=db < "C:\\Users\\abc\\Desktop\\db.sql"
ERROR 1049 (42000): Unknown database 'db'
Operation failed with exitcode 1
15:08:08 Import of C:\Users\abc\Desktop\db.sql has finished with 1 errors
Apparently the export was done without specifying a database (schema), so you have to create it manually first before you can import the dump. MySQL Workbench allows to import a dump to a different (including a new) schema. You can specify this on the import page:
You looks like you have to create a database first
CREATE DATABASE db;
and then import your sql file.

MySQL database - error when backup database

When i try do database backup in Linux i got this error,
"Got error: 1296: Got error 157 'Unknown error code' from NDBCLUSTER when using LOCK TABLE"
can someone please guide me what i have to do to solve this error.
Thanks.
Execute the following from the linux shell to make a database dump (backup)
mysqldump -p -u[username] --no-lock-tables [database]>dumpfile.sql
replace [username] and [database] with the appropriate credentials of yours, like:
mysqldump -p -uroot --no-lock-tables mydb>dumpfile.sql