我最近买了一台新电脑,所以我想把我所有的网络项目都搬过来。移动文件很容易,但是移动数据库似乎有点困难。我使用 phpMyAdmin 导出所有数据库,并将其保存到 localhost.sql。然后我尝试使用 phpMyAdmin 将其导入到我的新计算机上,但出现错误:
No data to import. Either no filename was sent or the filesize exceeded the maximum allowed size. See FAQ 1.16. (This was translated from Swedish)
我按照建议查看了常见问题解答。他们提到了一个名为 BigDump 的工具。所以我下载了它,在查看了运行它所需的设置后,我意识到我也不能使用它。为什么?因为它需要连接到一个特定的数据库。我正在尝试一次导入许多数据库。所以,那里没有成功。
我还尝试将 PHP 的 upload_max_filesize (以及常见问题解答中提到的另一个)设置为 999 之类的值。由于某种原因,这似乎不起作用。在再次运行之前,我确实重新启动了所有服务。
我应该提到,我在旧计算机上使用 XAMPP,并在新计算机上切换到 WAMP。但这应该不重要,对吧?因为这两个“包”都使用 phpMyAdmin 和 apache。
关于如何绕过这个噩梦有什么建议吗?
I recently got a new computer, so I thought I'd move all my web projects over. Moving the files was easy, however, moving the database seems to be a bit harder. I exported ALL databases using phpMyAdmin, and saved it to localhost.sql. Then I tried to import it on my new computer also using phpMyAdmin, and I get the error:
No data to import. Either no filename was sent or the filesize exceeded the maximum allowed size. See FAQ 1.16. (This was translated from Swedish)
I took a look at the FAQ, as advised. And they mentioned a tool called BigDump. So I downloaded it, and after looking at the settings you need to run it I realised that I CAN'T USE THAT EITHER. Why? Because it requires a connection to one specific database. I'm trying to import MANY databases at once. So, no success there.
I also tried setting PHP's upload_max_filesize (and the other one's mentioned in the FAQ) to something like 999. That doesn't seem to work either for some reason. I did restart all services before I ran it again.
I should mention that I used XAMPP on my old computer, and I switched to WAMP on my new one. That shouldn't matter though, right? As both "packages" uses phpMyAdmin and apache.
Any suggestions on how to bypass this nightmare?
发布评论
评论(17)
操作方法
确保您在 "php.ini"(位于 "php.ini 所在位置)中同时更改 *"post_max_size"* 和 *"upload_max_filesize"*。 exe” 是)。
以下示例允许您上传和导入 128MB sql 文件:
重新启动 Apache,一切就绪。
替代方法
解决该问题的另一种方法是使用命令行。但这只是一种解决方法,并且与解决方法一样丑陋:
由于您不使用服务器而是命令行,因此上传和 POST 大小并不重要。这就是为什么我称其为“解决方法”,因为它实际上并不能解决您的问题。
HowTo
Make sure you change both *"post_max_size"* and *"upload_max_filesize"* in your "php.ini" (which is located where your "php.exe" is).
The following example allows you to upload and import 128MB sql files:
Restart Apache and you're all set.
Alternatives
An alternative way to work around the problem is to use the command line. But it's a workaround, and as ugly as workarounds get:
As you're not using the server but the command line, upload and POST sizes don't matter. That's why I call this a "workaround", since it doesn't actually solve your problem.
其他人总是尝试重新配置 php.ini 文件,但对我来说,我认为最佳实践是使用 MYSQL 控制台,因为它确实节省了您的时间。
以下是 MYSQL 控制台的分步指南:
打开 MYSQL 控制台,然后运行它。
类型:
mysql>使用database_name;
mysql> source location_of_your_file;
location_of_your_file 应该类似于 C:\mydb.sql
所以命令是 mysql>source C:\mydb.sql;
这种导入 sql 转储对于 BIG SQL 非常有帮助文件。
我将文件 mydb.sql 复制到目录 C: 。它应该是大写 C: 才能运行,因为它会给你一个 mysql 错误或语法错误
Others are always trying to reconfigure the php.ini file but for me I think the best practice is use your MYSQL console because it really saves your time.
Here are the step by step guide to the MYSQL Console:
Open your MYSQL Console then run it.
Type:
mysql> use database_name;
mysql> source location_of_your_file;
location_of_your_file should look like C:\mydb.sql
so the command is mysql>source C:\mydb.sql;
This kind of importing sql dump is very helpful for BIG SQL FILE.
I copied my file mydb.sql to directory C: .It should be capital C: in order to run because it will give you a mysql error or syntax error
在 wamp 服务器中:
in wamp server:
在
xampp\php\php.ini
中进行更改查找:
更改为:
Make changes in
xampp\php\php.ini
Find:
Change to:
您可以从命令行导入 - 类似
mysql < databasedump.sql
(取决于操作系统)。You can import from the command line - something like
mysql < databasedump.sql
(depending on the OS).按照以下步骤转储大型数据库:
1) 从 BigDump.php ="nofollow">http://www.ozerov.de/bigdump/
2) 将您的 bigdump.php 和 databasedump.sql 移动到项目文件夹中(htdocs 或 www)。
3) 打开 bigdump.php 文件并编辑以下部分:
4) 在浏览器中打开 bigdump.php 并单击导入链接。
Follow this step to dump huge database:
1) Download php script BigDump.php from http://www.ozerov.de/bigdump/
2) Move your bigdump.php and your databasedump.sql in projects folder (htdocs or www).
3) open bigdump.php file and edit bellow section:
4) open bigdump.php in browser and click on import link.
这将在几秒钟内导入您的大型 sql 文件:
不要使用 phpmyadmin 导入大型 sql 文件。如果你在线使用mysql,那么采取mysql控制台访问。
This will import your large sql file within few seconds:
Don't use phpmyadmin to import large sql files. If you are using mysql online, then take the mysql console access.
压缩 sql 文件(仅限 gzip、bzip2、zip)并导入。压缩 db csv 文件等测试文件将显着减小文件大小(约 11 mb 至 2 mb),并且 phpmyadmin 导入引擎可以检测压缩数据
compress sql file (only gzip, bzip2, zip) and import it. compressing test files like db csv file will reduce file size dramatically (~ 11 mb to 2 mb) and phpmyadmin import engine cand etect compressed data
我知道这很旧但是..
我很久以前就想到了这个问题。
我要么使用控制台来执行转储sql 文件。
或者我使用 adminer 作为 PHPmyAdmin 的替代品。
I know this is old but..
I came up with this problem long ago.
Either I used the console to execute dump sql file.
Or I use adminer as an alternative to PHPmyAdmin.
修改my.ini文件
中的[mysqld]部分添加以下行
重新启动mysql
打开dump.sql文件
添加以下
行转到 mysql 文件夹并运行此命令
Modify the my.ini file
in the [mysqld] section add the following lines
Restart the mysql
open the dump.sql file
add the following lines
Go to the mysql folder and run this command
phpmyadmin 还能够从硬盘读取数据 - 上传转储并使用此功能。但是,如果可能的话,我强烈建议您从控制台进行。它的速度要快得多,因为 php 不必先处理文件,它会直接加载到服务器中。
phpmyadmin has the ability to read from the harddrive as well - upload the dump and use this feature. However, I would strongly advise you to the from the console if possible. It's way faster as php doesn't have to process the file first and it gets loaded directly into the server.
如果您上传的数据库非常大,但 Web 界面将限制为 HTTP 最大 HTTP 请求大小
编辑
PHP.ini
以增加上传限制找到此行
然后重启服务器
或者使用directadmin重启http服务
If you are having a very large database uploading though the web interface will be limited to HTTP maximum HTTP request size
Edit the
PHP.ini
to increase the upload limitfind this line
Then restart the server
or use directadmin to restart the http service
使用SQLYog进行数据库操作是专业人士的最佳选择。通过使用 SQLYog,您可以导入 nGB {n->finite_size} 的 sql 数据库。
Use SQLYog for db operations it is the best choice for professional. By using SQLYog you can import nGB {n->finite_size} of sql db.
我尝试更改允许的大小,但这并没有解决问题。
但是,在我的特定情况下,有一个名为“uploaddir”的文件夹,位于:
我将 SQL 文件放在那里,然后返回到 PHP My Admin 的“导入”选项卡。
有一个选项允许我上传已位于“uploaddir”文件夹中的文件;他们没有限制。
我正在使用 Windows 和 EasyPHP 12.1
I tried to change the allowed size, but that didn't fixed the problem.
However, there's a folder called "uploaddir", in my particular case, located in:
I put the SQL file there, and then went back to the "Import" tab of PHP My Admin.
There's an option that allowed me to upload files that were already located in "uploaddir" folder; and they have no limit.
I'm using Windows and EasyPHP 12.1
简单的解决方案是只需下载并安装安装“MySql Workbench”软件,它基于图形用户界面且易于使用。我最近导入了300mb大小的mysql数据库。
Simple solution is that just download & install "MySql Workbench" software, its gui based and easy to use.I have recently import 300mb size mysql database.
如果您使用的是 Linux,您可以转到终端,在连接到 mysql 并选择数据库后,只需键入:
If you'r on linux, you can go to terminal and after connect to mysql and select database, simply type:
sql 重新提交链接
您可以再次重新提交 SQL 文件,直到数据库未完全上传
sql resubmit link
You can resubmit your SQL file again until database not fully uploaded