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
Related
I'm trying to import a sql file that is on the server using the following command in the terminal
mysql -u NAME -p DBNAME < path/to/FILE.sql
when i do that it asks for the password, after inputting the password nothing happens. I check the database and no tables have been added.
Note:
DBNAME is created in the mysql database.
I have also tried the following syntax in mysql and also that didn't work
mysql> source PATH/TO/FILE.sql
Please Help :D
The sql file was corrupt, all i had to do was delete it and upload it once again. thanks #CBroe
Hello you can trying with
Create the database for import the tables:
mysql -u root -p
create database database_name;
exit
mysql -u user -p databasename < databasename.sql
I'm using MySQL Workbench 6.3.6 build 511 CE (64 bits) with MySQL 5.6.25 on Windows 10 that was bundled with XAMPP 5.6.11.
It used to work fine for almost a month in this configuration. I don't recall changing any settings, but suddenly now when I want to export my db it throws this error
mysqldump: Got error: 2013: Lost connection to MySQL server at
'reading authorization packet', system error: 2 when trying to connect
Operation failed with exitcode 2
The error appears even when I try calling mysqldump myself from cmd.
The command that workbench used was this
14:23:26 Dumping invento (all tables)
Running: mysqldump.exe --defaults-file="c:\users\rog\appdata\local\temp\tmp0apjw4.cnf" --host=127.0.0.1 --insert-ignore=TRUE --protocol=tcp --user=root --force=TRUE --port=3306 --default-character-set=utf8 --routines --events "invento"
I should add that the error doesn't always appear
Exit code 2 usually indicates that there is a permissions problem. The most usual suspect is the lack of permissions for the LOCK TABLES command on the given database or table(s) you are trying to dump.
Make sure that the user you use to create the backup with has this permission on the given database table(s). Alternatively you can use the --skip-lock-tables mysqldump option (also see the documentation), so you'll get something like:
mysqldump.exe --defaults-file="c:\users\rog\appdata\local\temp\tmp0apjw4.cnf"
--host=127.0.0.1 --insert-ignore=TRUE --protocol=tcp
--user=root --force=TRUE --port=3306 --default-character-set=utf8
--routines --events "invento"
--skip-lock-tables
I want to backup my database using mysql dump. This is the code I run in Command prompt when the location is mysql bin.
mysqldump -u root -pabc Db -r C:\Documents and Settings\All Users\Desktop\ttttt.sql
abc is the password. and I try to backup to a .sql file in desktop. I use mysql 5.5.
But the following error occured. mysqldump: Couldn't find table: "and"
But there is no table called 'and' in database and I didn't create such a table.But the error say about a 'and' table. How can I back up mysql database without this error.
Try instead:
mysqldump -u root -pabc Db -r "C:\Documents and Settings\All Users\Desktop\ttttt.sql"
Your command shell is breaking apart the pathname into multiple arguments. The quotes tell the shell to pass it all as a single argument to the mysqldump program.
I think there is some problem with syntax of command you are running. try something like this :
mysqldump -u root -p dbName > path\nameOfFile.sql
It will automatically ask for your password. You don't need to write it in command.
I'm having some difficulty with mysqldump. I locked my tables and ran the following command:
mysqldump -u user -p password databasename using my actual password and database name.
When I run this from mysql I get a 1064 error that says there is an issue with my syntax. I've also tried running the command from terminal (outside of mysql) and receive a 'command not found' error message. I'm not entirely sure how I should be doing this (the explanations I've found so far have been vague).
Thanks for the help.
The mysqldump is a program, it cannot be executed from the mysql console. Run it from the shell.
Have a look at the syntax reference.
--user=user_name, -u user_name
--password[=password], -p[password]
As you see there is no space between -p and password. So, your command line should be like this:
>shell mysqldump -u <user_name> -p<user_password> ...
or
>shell mysqldump --user=<user_name> --password=<user_password> ...
You are missing the target backup file name:
# [mysql dir]/bin/mysqldump -u username -p password --databases databasename > /tmp/databasename.sql
MySQL Commands
the correct syntax is
mysqldump -u [username] -p[password] [databasename] > [backupfile.sql]
you should add the > backupfile.sql
the other error is believe your system doesn't recognize the mysqldump path and you should go directly to bin folder from mysql installation.
I'm using WAMP Server in a local PC.
I'm trying to export a big database using MySQL console but its just not working. I always get a syntax error 1064
The queries I tried:
mysqldump -u USER -p DATABASE > backup.sql;
mysqldump -u USER -pPASSWORD DATABASE > backup.sql;
(of course I'm replacing USER, PASSWORD and DATABASE with real values)
I also tried some more similar queries but I'm getting the same syntax error every time.
Please help!!!!!
You should type this in your command prompt not in MySQL console.
mysqldump is an application not MySQL command.