import a dump file mysql ubuntu - mysql

I installed mysql server on my machine running ubuntu then after installation I did the following:
mysql -u root -p to get mysql prompt
2.create database prediction ;
create user adam;
set password for adam = password("12211");
grant all privileges on prediction.* to adam identified by '12211';
use prediction;
-u adam -p prediction
I get the 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 khalil -p prediction

Your error message doesn't correspond to your #6 entry (adam v.s. khalil). In any case, you cannot simply enter -u whatever into the mysql command line. Those are command line options, not sql commands/queries. You'd need to EXIT mysql first, then re-enter
$ mysql -u adam -p prediction
at the shell prompt

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.

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.

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..

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

Trying to set MySQL root password results in error

I'm still very new to MySQL and Debian, but have been reading a lot during the last days.
I have a root account to a virtual machine that I want to use for Wordpress. One thing I read was that I should password protect MySQL because by default root user doesn't need a password for it.
I read someone doing it like this:
mysql> mysqladmin -u root password mypassword;
But that gives me the following 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 'mysqladmin -u root password mypassword' at line 1
You are running the command from within mysql, but the command is actually meant to be run directly from the terminal.
mysqladmin -u root password mypassword
If you are already in mysql within terminal, type exit then enter your mysqladmin command.