mysql: unable to use mysqldump on production - mysql

I tried below commands,
mysqldump -h 127.0.0.1 -u username -p db_name > dumpfile.sql;
mysqldump -u username -p password db_name > dumpfile.sql;
mysqldump db_name > dumpfile.sql;
It always throw this error:
ERROR 1064 (42000): 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 'mysqldump ..' at line 1
mysql version: 5.7

You should launch this command from CLI as it's a separate binary executable. According to the message you get you trying to execute it as SQL command and it's totally incorrect.

Related

Getting syntax error while exporting mysql database

I have cPanel trial version installed on the centOS server which is expired now. So I don't have access to cPanel user and WHM login.
I am tried the following
mysql> mysqldump -u root –ppassword db_name > db_nametext.sql;
ERROR 1064 (42000): 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 mysqldump -u root –ppassword db_name > db_name at line 1
Thank you for time and consideration.
You cannot run mysqldump from mysql shell: mysqldump is not a SQL statement but an executable that must be run from linux shell like mysql command.

How to export .sql file in MySQL database using MySQL commandline client?

How to MySQL server database export .sql file using command line?
I have used below commands,but shows in syntax error
mysqldump -h ipaddress -u username -p password> mysqlfile.sql
I have below Error:
ERROR 1064 (42000): 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 'mysq
dump -h 192.268.1.17 -u root -p root> mysqlfile.sql' at line 1

Can't backup with MariaDB Console

I am trying to take a backup of a database. I open up the MariaDB client console on windows 10, enter root password and then enter this:
MariaDB [(none)]> mysqldump database_name > backup.sql;
It returns this error:
ERROR 1064 (42000): 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 'mysqldump database_name > backup.sql' at line 1
What did I do wrong?
Try using
mysqldump -u root -p database_name > file.sql
before logging to database (new CLI window). You will have to enter root password after this command
You should be able to run this command in any CLI, like CMD.exe or Git Bash - depending on the way you installed things on your machine. I hope this helps

MySQL: Trying set a password for root, Error in SQL Syntax

This piece of code is from the Learning MySQL and MariaDB book:
mysql -u root -p -e "SET PASSWORD FOR 'root'#'127.0.0.1' PASSWORD('new_pwd');"
And I'm getting this error:
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for th
e right syntax to use near 'PASSWORD('new_pwd')' at line 1
Is this book correct? Isn't this syntax old? What's the problem?
try with:
mysql -u root -p -e "SET PASSWORD FOR 'root'#'127.0.0.1' = PASSWORD('new_pwd');"

backup the database using MySql

hi i want to backup my MySql database,
i write this command :
mysqldump -u root -ppassword -h localhost --all-databases > backup.sql;
and it give this error:
ERROR 1064 (42000): 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 'mysql
dump -u root -pmanager -h localhost --all-databases > backup.sql' at line 1
why?
and what should be do?
thanks...
You are running this command in mysql. You should be running it from the command line instead.