Unable to import database to mysql in CentOS 6.3 - mysql

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

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.

importing sql dump file for a wordpress site error

I am trying to restore a mysql dump file for a wordpress site.
I am using mysql Ver 14.14 on ubuntu 16.04
I tried this command as I have used it before with different projects
$ mysql -u USER -p NEW_DATABASE < DUMP_FILE.sql
I am getting this error after prompted for password
ERROR 1064 (42000) at line 944: 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
''a:406:{i:0;a:7:{s:4:\"slug\";s:15:\"general_options\";s:6:\"parent\";s:15:\"gen'
at line 1

How can I connect to MySQL server remotely using MySQL command line client (In Windows)? keep getting error 1064 (4200)

I'm using this method below to connect to my remote MySQL database but I keep getting this error message back:
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 admin -p demo123-h testaurora-cluster-1.cluster-tjiy9ao2kavg.us-west-2.' at line 1
Method:
mysql -u USERNAME -p PASSWORD -h HOSTNAMEORIP DATABASENAME
The options above means:
-u: username
-p: password (**no space after**)
-h: host
last one is name of the database that you wanted to connect.
Look into the the link, it's detailed there!
Code entered in MySQL command line client:
mysql -u admin -p demo123-h testaurora-cluster-1.cluster-tjiy9ao2kavg.us-west-2 TestTable
I would highly appreciate it if you can let me know what I am missing here..

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.

Cannot connect to MySQL via XAMP

It has been headache for me to connect to MySQL.
Background:
OS: Windows 7 (64 bits)
I have been trying to connect to the MYSQL. I am using XAMPP control panel v3.1.0.
The Apache is working fine and I can run my PHP programs on it to upload and move files and all.
I connect the MySQL and it shows in XAMP and it is running :
12:27:48 PM [mysql] Attempting to start MySQL app... 12:27:48 PM
[mysql] Status change detected: running
I logged in to http://localhost/phpmyadmin and it did not ask me a password as XAMPP did not ask me for any password during the time of installation.
I created username pingu from http://localhost/phpmyadmin and gave it a password as well.
My questions:
1.) I do not know how to login as a user.
I get the following error when I use: mysql> -u pingu -p;
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 pingu -p' at line 1
I have even tried:
mysql> -u root -p admin;
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 admin' at line 1
2.) When I try to create a database from the command line MySQL it gives me the following error:
MySQL> CREATE DATABASE publications; ERROR 1044 (42000): Access denied
for user ''#'local host' to database 'publications'
Any ideas?
First locate your XAMPP install C:\Program Files\xampp for a full install.
Open a new Command Prompt Window:
Click Start
Type "cmd"
Hit enter
In Command prompt go to the XAMPP directory do not include the C: part
cd \path\to\xampp
Start MySql:
mysql\bin\mysql.exe -u pingu -p