MySQL phpMyAdmin - 错误 > 格式参数不正确?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50690076/
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 22:56:49  来源:igfitidea点击:

phpMyAdmin - Error > Incorrect format parameter?

databasemysql

提问by henry

I have a WordPress production website.

我有一个 WordPress 生产网站。

I've exported the database by the following commands: select database > export > custom > select all tables > select .zip compression > 'Go'

我已经通过以下命令导出了数据库: select database > export > custom > select all tables > select .zip compression > 'Go'

I've downloaded the file which is example.sql.zip but when I upload to my localhost I get this error: phpMyAdmin - Error > Incorrect format parameter

我已经下载了 example.sql.zip 文件,但是当我上传到我的本地主机时,我收到了这个错误: phpMyAdmin - Error > Incorrect format parameter

I've tried to export with other formats and I get the same error.

我尝试使用其他格式导出,但遇到相同的错误。

I've tried with other SQL Databases and it exports/ imports just fine.

我试过其他 SQL 数据库,它导出/导入得很好。

What could it be? A corrupt database or other?

会是什么呢?损坏的数据库或其他?

Thanks

谢谢

回答by Pooja Mistry

This issue is not because of corrupt database. I found the solution from this video - https://www.youtube.com/watch?v=MqOsp54EA3I

这个问题不是因为数据库损坏。我从这个视频中找到了解决方案 - https://www.youtube.com/watch?v=MqOsp54EA3I

It is suggested to increase the values of two variables in php.ini file. Change following in php.ini

建议增加php.ini文件中两个变量的值。在 php.ini 中更改以下内容

upload_max_filesize=64M
post_max_size=64M

Then restart the server.

然后重启服务器。

This solved my issue. Hope solves yours too.

这解决了我的问题。希望也能解决你的问题。

回答by mattavatar

Compress your .sqlfile, and make sure to name it .[format].[compression], i.e. database.sql.zip.

压缩您的.sql文件,并确保将其命名为.[format].[compression],即 database.sql.zip.

As noted above, PhpMyAdmin throws this error if your .sqlfile is larger than the Maximum allowed upload size -- but, in my case the maximum was 50MiB despite that I had set all options noted in previous answers (look for the "Max: 50MiB" next to the upload button in PhpMyAdmin).

如上所述,如果您的.sql文件大于允许的最大上传大小,PhpMyAdmin会抛出此错误——但是,在我的情况下,尽管我已经设置了之前答案中提到的所有选项(查找“最大:50MiB”),但最大值为 50MiB在 PhpMyAdmin 中的上传按钮旁边)。

回答by Martin N

For me, adjusting the 2 values was not enough. If the file is too big, you also need to adjust the execution time variables.

对我来说,调整 2 个值是不够的。如果文件太大,还需要调整执行时间变量。

First, ../php/php.ini

首先,../php/php.ini

upload_max_filesize=128M
post_max_size=128M
max_execution_time=1000

Then, ../phpMyAdmin\libraries\config.default.php

然后,../phpMyAdmin\libraries\config.default.php

$cfg['ExecTimeLimit'] = 1000;

This did the trick for me. The variables can be choosen differently of course. Maybe the execution time has to be even higher. And the size depends on your filesize.

这对我有用。当然可以选择不同的变量。也许执行时间必须更长。大小取决于您的文件大小。

回答by Pedro Araujo Jorge

None of these answers worked for me. I had to use the command line:

这些答案都不适合我。我不得不使用命令行:

mysql -u root db_name < db_dump.sql
SET NAMES 'utf8';
SOURCE db_dump.sql;

Done!

完毕!

回答by u5675325

Just gone through the same problem when trying to import a CSV (400 MBs) and was also getting an error in red saying

尝试导入 CSV (400 MB) 时遇到了同样的问题,并且还收到了红色错误提示

Error - incorrect format parameter

错误 - 格式参数不正确

Initially thought it could have been the parameters and tested again. Faster, from my previous experince with it, I realized that it was due to other reasons (size of the file, execution of script has a maximum time defined, etc).

一开始以为可能是参数问题,再次测试。更快,根据我以前的经验,我意识到这是由于其他原因(文件大小、脚本执行有定义的最长时间等)。

So, I've gone to php.ini

所以,我去了 php.ini

php.ini

配置文件

and changed the values from the following settings

并更改了以下设置中的值

max_execution_time = 3000
max_input_time = 120
memory_limit = 512M
post_max_size = 1500M
upload_max_filesize = 1500M 

After this modification, stoped MySQL and Apache and started them again, went to phpmyadmin trying to import. Then I reached another error

这次修改后,停止MySQL和Apache并重新启动它们,去phpmyadmin尝试导入。然后我遇到了另一个错误

Fatal error: Maximum execution time of 300 seconds exceeded

致命错误:超出最大执行时间 300 秒

which was fixed by simply setting in xampp/phpmyadmin/libraries/config.default.php

只需在 xampp/phpmyadmin/libraries/config.default.php 中设置即可修复

config.default.php

config.default.php

$cfg['ExecTimeLimit'] = 0;

Setting it to 0 disables execution time limits.

将其设置为 0 将禁用执行时间限制。

Then, after a while, the import happened without problems.

然后,过了一会儿,导入没有问题。

回答by Chantel Gonzales

I was able to resolve this by following the steps posted here: xampp phpmyadmin, Incorrect format parameter

我可以按照此处发布的步骤解决此问题:xampp phpmyadmin,格式参数不正确

Because I'm not using XAMPP, I also needed to update my php.ini.defaultto php.iniwhich finally did the trick.

因为我没有使用XAMPP,我也需要升级我php.ini.defaultphp.ini这最后的伎俩。

回答by Kairat Koibagarov

Without any problems, I imported directly from the command line.

没有任何问题,我直接从命令行导入。

mysql -uroot -hURLServer -p DBName< filename.sql

回答by to240

This error is caused by the fact that the maximum upload size is (Max: 2,048KiB). If your file is bigger than this, you will get an error. Zip the file and upload it again, you will not get the error.

此错误是由最大上传大小为 (Max: 2,048KiB) 引起的。如果你的文件比这个大,你会得到一个错误。压缩文件并再次上传,您将不会收到错误消息。

回答by Helen Lee

I had this error and as I'm on shared hosting I don't have access to the php.ini so wasn't sure how I could fix it, the host didn't seem to have a clue either. In the end I emptied my browser cache and reloaded phpmyadmin and it came back!

我遇到了这个错误,因为我在共享主机上,我无法访问 php.ini,所以不确定如何修复它,主机似乎也没有任何线索。最后,我清空了浏览器缓存并重新加载了 phpmyadmin,它又回来了!

回答by Schwarz54

I had this problem but with a docker container (phpmyadmin users),

我遇到了这个问题,但是使用 docker 容器(phpmyadmin 用户),

Solution:

解决方案:

  • Enter in the phpmyadmin container docker exec -it idcontainer /bin/bash
  • Move cd /usr/local/etc/php/
  • Create php.inifile
  • Modify it upload_max_filesize=128M post_max_size=128M max_execution_time=1000
  • Save and restart container.
  • 进入phpmyadmin容器 docker exec -it idcontainer /bin/bash
  • 移动 cd /usr/local/etc/php/
  • 创建php.ini文件
  • 修改它 upload_max_filesize=128M post_max_size=128M max_execution_time=1000
  • 保存并重启容器。

This problem was in a Windows pc, at Linux i didnt need to do this.

这个问题出在 Windows 电脑上,在 Linux 上我不需要这样做。