5

Tried importing a database backup(.sql) from docker container mysql:5.6 into my local MySQL(MariaDB).

Here is the commands I've used:

mysql -u root -p database_name < /opt/database.sql  
mysql -u root -p  database=database_name </opt/database.sql

Also wanna try mysqlimport but I always encounter the same error.

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'mysql Ver 14.14 Distrib 5.6.33, for Linux (x86_64) using EditLine wrapper Copy' at line 1

Can anyone please tell me what is the right syntax on importing database from mysql into mariadb.

6
  • Remove the first 4 lines from your sql file and try again Commented Sep 30, 2016 at 20:59
  • @Hackerman thank you for the response but still no luck bro. Commented Oct 3, 2016 at 2:52
  • Can you post the first 10 lines of you sql file? Commented Oct 3, 2016 at 2:56
  • @Ullas It's my first post here in stack overflow sorry for the wrong format. Thank you very much! Commented Oct 3, 2016 at 2:59
  • @Hackerman Here it is bro: mysql Ver 14.14 Distrib 5.6.33, for Linux (x86_64) using EditLine wrapper Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Usage: mysql [OPTIONS] [database] -?, --help Display this help and exit. -I, --help Synonym for -? darn bad format sorry! Commented Oct 3, 2016 at 3:08

1 Answer 1

5

You tried to create a dump with mysql command line client instead of mysqldump.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the answer! I've used mysql dump instead of mysqldump command. @Georg
what is the full syntax to dump with mysql command instead of mysqldump ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.