简体   繁体   English

MySQL导入转储文件Ubuntu 10.10

[英]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: 我正在使用ubuntu在我的机器上运行mysql服务器,并尝试导入转储文件,如下所示,我也收到如下所示的错误:

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; 错误1064(42000):您的SQL语法有错误; check the manual that corresponds to your MySQL server version for the right syntax to use near '-u rami -p mm 检查与您的MySQL服务器版本相对应的手册以获取正确的语法,以在'-u rami -p mm附近使用

While in the mysql> prompt, use the source command to import the file. mysql>提示符下时,使用source命令导入文件。

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: 否则,请在Linux中的shell提示符下,尝试在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 . 然后,这将提示您输入密码,并将文件导入数据库mm It is unclear from your command attempts if you wanted to import this into the database mm or into prediction . 从命令尝试中尚不清楚,是否要将其导入数据库mmprediction If it should have been prediction , use: 如果应该是prediction ,请使用:

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

Install pv (PipeViewer) 安装PV(PipeViewer)

sudo apt-get install pv

pv displays progress of your data import (percentage), elapsed time and predicts remaining time pv显示数据导入进度(百分比),经过时间并预测剩余时间

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM