Getting syntax error while exporting mysql database - mysql

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.

Related

mysql: unable to use mysqldump on production

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.

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

How to take mysql database Backup in MAC os via command prompt

i am using MAC os and trying to get the mysql database backup with the following command but its giving database error:
mysqldump -u root -proot syslog > syslog.sql
while running this command showing 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 '-u root -p syslog > syslog.sql' at line 1
You appear to be running mysqldump from within the mysql interpreter. Instead, you need to run it from your shell prompt.

Unable to import database to mysql in CentOS 6.3

I want to import database file to MySql in Centos 6.3 I entered the following command mysql -u root -p database < filename.sql but I faced the error as
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 -u root -p Kalsym < /tmp/dump.sql' at line 1
I have tried all the commands that I found on various forums but nothing seems to be working here :(
I guess you run this query after login into your MySQL server as it gives sytax error, right?
This command is run from the shell not from the mysql console..
So try running from command prompt/ shell not after login in to the mysql server.
Thanks

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.