MySQL 使用wamp将sql文件导入数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26310424/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 13:06:33  来源:igfitidea点击:

importing sql file into a database using wamp

mysqlwamp

提问by Gogo

I tried importing my yyy.sql file ( a large file) into xxx database through wampserver. I copied yyy.sql file to C: drive and through mysql console mysql> use xxx mysql>source C:\yyy.sql

我尝试通过 wampserver 将我的 yyy.sql 文件(一个大文件)导入到 xxx 数据库中。我将 yyy.sql 文件复制到 C: 驱动器并通过 mysql 控制台 mysql> use xxx mysql>source C:\yyy.sql

when I execute these commands it seems its reading each row. after that it gives mysql> and when I check the xxx database it's showing empty. what's wrong?

当我执行这些命令时,它似乎在读取每一行。之后它给出了 mysql> 并且当我检查 xxx 数据库时它显示为空。怎么了?

回答by Meer

Option 1;PHPMyAdmin

选项1; PHPMyAdmin

1. left click wamp -> phpmyadmin
2. select database then click import (top right)
3. locate the database and click go.

Option 2;Using the command line.

选项 2;使用命令行。

The easiest way to import a sql file into a database in WAMP, using command line is as follows:

在WAMP中将sql文件导入数据库的最简单方法,使用命令行如下:

1. Open Command Prompt (CMD - DOS) get into the mysql folder, which in my case works like this
C:\> cd C:\wamp\bin\mysql\mysql5.0.51b\bin

2. Then use this command to fire up MySQL
   This line basically connects you to the mysql database of your choice.
   (-p for password if you have one)
C:\wamp\bin\mysql\mysql5.0.51b\bin> mysql.exe -use databasename -u username -p

3. To make things easier, copy the SQL file into the same folder as mysql.exe, and then run this
mysql> source myfilename.sql;

回答by Subodh Kumar

  1. OPEN your filename.sql in NOTEPAD.....

  2. COPY all content..... left

  3. Click wamp>phpmyadmin.....

  4. CREATE new Database.....
  5. and Click on SQL tab and PASTE the content.....
  6. then Click on GO..... Hurray!

    you have done

  1. 在记事本中打开你的 filename.sql ......

  2. 复制所有内容..... 离开

  3. 点击 wamp>phpmyadmin.....

  4. 创建新数据库.....
  5. 并单击 SQL 选项卡并粘贴内容.....
  6. 然后点击GO.....万岁!

    你已经完成了