hamid
hamid

Reputation: 531

mysql import dump file ubuntu 10.10

am running mysql server on my machine using ubuntu, am trying to import dump file as indicated below, I get an error shown below as well:

create database mm;
create user rami;
set password for rami = password("112211");
grant all privileges on prediction.* to rami identified by '112211';
use prediction;
-u rami -p mm </home/user/Downloads/SNPdbe_2012_03_05_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 '-u rami -p mm

Upvotes: 2

Views: 4659

Answers (3)

Sergey Grigoriev
Sergey Grigoriev

Reputation: 719

Install pv (PipeViewer)

sudo apt-get install pv

pv displays progress of your data import (percentage), elapsed time and predicts remaining time

pv /home/user/Downloads/SNPdbe_2012_03_05_sql | mysql -u rami -p prediction

Upvotes: 0

manurajhada
manurajhada

Reputation: 5390

$ mysql -u rami -p prediction < /home/user/Downloads/SNPdbe_2012_03_05_sql;

Upvotes: 1

Michael Berkowski
Michael Berkowski

Reputation: 270767

While in the mysql> prompt, use the source command to import the file.

mysql> create database mm;
mysql> create user rami;
mysql> set password for rami = password("112211");
mysql> grant all privileges on prediction.* to rami identified by '112211';
mysql> use prediction;
mysql> source /home/user/Downloads/SNPdbe_2012_03_05_sql;    

Otherwise, from the shell prompt in Linux, run it from the command line as you attempted to do inside MySQL:

$ mysql -u rami -p mm </home/user/Downloads/SNPdbe_2012_03_05_sql;

This should then prompt for your password and import the file into the database mm. It is unclear from your command attempts if you wanted to import this into the database mm or into prediction. If it should have been prediction, use:

$ mysql -u rami -p prediction </home/user/Downloads/SNPdbe_2012_03_05_sql;

Upvotes: 4

Related Questions