导入 db phpMyAdmin - 错误格式参数不正确

Posted

技术标签:

【中文标题】导入 db phpMyAdmin - 错误格式参数不正确【英文标题】:importing db phpMyAdmin - Error Incorrect format parameter 【发布时间】:2018-12-16 20:51:12 【问题描述】:

我正在尝试将生产 mysql 数据库导入本地 xampp 测试环境。通过连接到网络管理员(mozff)和简单的导出 sql(不需要其他任何东西)。然后转到本地 phpmyadmin 仪表板并导入。它抛出以下错误

错误:

直播环境:

数据库服务器

Server: db01.l2.url.com via TCP/IP
Server-Typ: MariaDB
Server-Version: 10.1.26-MariaDB-0+deb9u1 - Debian 9.1
Protokoll-Version: 10
User: user
Server-encoding: UTF-8 Unicode (utf8)

网络服务器

Apache
Datenbank-Client Version: libmysql - mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $
PHP-Erweiterung: mysqliDokumentation curlDokumentation mbstringDokumentation
PHP-Version: 7.0.27-0+deb9u1

phpMyAdmin

Version informationen: 4.6.6deb4 

测试环境

数据库服务器

Server: 127.0.0.1 via TCP/IP
Server-Typ: MariaDB
Server-connection: SSL not used
Server-Version: 10.1.33-MariaDB - mariadb.org binary distribution
Protokoll-Version: 10
user: root@localhost
Server-encoding: UTF-8 Unicode (utf8)

网络服务器

Apache/2.4.33 (Win32) OpenSSL/1.1.0h PHP/7.2.6
Datenbank-Client Version: libmysql - mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $
PHP-extension: mysqliDokumentation curlDokumentation mbstringDokumentation
PHP-Version: 7.2.6

phpMyAdmin

Version informationen: 4.8.1, aktuelle stabile Version: 4.8.2

问题:

    我在哪里可以看到哪个参数不正确? 我假设 mysql 4.8.1 db 向后兼容 4.6.6deb4 ..??

我尝试过的:

phpMyAdmin - Error > Incorrect format parameter?

xampp phpmyadmin, Incorrect format parameter

日志:

180709 11:52:25   246 Connect   pma@localhost as anonymous on 
          247 Connect   root@localhost as anonymous on 
          247 Query SELECT @@version, @@version_comment
          247 Query SET NAMES 'utf8mb4' COLLATE 'utf8mb4_general_ci'
          247 Query SET lc_messages = 'de_DE'
          246 Query SELECT `config_data`, UNIX_TIMESTAMP(`timevalue`) ts FROM `phpmyadmin`.`pma__userconfig` WHERE `username` = 'root'
          246 Query SELECT `config_data`, UNIX_TIMESTAMP(`timevalue`) ts FROM `phpmyadmin`.`pma__userconfig` WHERE `username` = 'root'
          247 Query SET collation_connection = 'utf8mb4_unicode_ci'
          247 Init DB   mysql
          247 Query SHOW SESSION VARIABLES LIKE 'FOREIGN_KEY_CHECKS'
180709 11:52:26   247 Quit  
          246 Quit  
180709 11:52:33   248 Connect   pma@localhost as anonymous on 
          249 Connect   root@localhost as anonymous on 
          249 Query SELECT @@version, @@version_comment
          249 Query SET NAMES 'utf8mb4' COLLATE 'utf8mb4_general_ci'
          249 Query SET lc_messages = 'de_DE'
          248 Query SELECT `config_data`, UNIX_TIMESTAMP(`timevalue`) ts FROM `phpmyadmin`.`pma__userconfig` WHERE `username` = 'root'
          249 Query SET collation_connection = 'utf8mb4_unicode_ci'
          249 Query SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`, (SELECT DB_first_level FROM ( SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) DB_first_level FROM INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t ORDER BY DB_first_level ASC LIMIT 0, 100) t2 WHERE TRUE AND 1 = LOCATE(CONCAT(DB_first_level, '_'), CONCAT(SCHEMA_NAME, '_')) ORDER BY SCHEMA_NAME ASC
          248 Query SELECT `db_name`, COUNT(*) AS `count` FROM `phpmyadmin`.`pma__navigationhiding` WHERE `username`='root' GROUP BY `db_name`
          249 Query SELECT COUNT(*) FROM ( SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) DB_first_level FROM INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t
          249 Query SELECT COUNT(*) FROM ( SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) DB_first_level FROM INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t
          248 Query SELECT * FROM `phpmyadmin`.`pma__bookmark` WHERE ( `user` = '' OR `user` = 'root' ) ORDER BY label ASC
          249 Quit  
          248 Quit  
180709 11:52:51   250 Connect   pma@localhost as anonymous on 
          251 Connect   root@localhost as anonymous on 
          251 Query SELECT @@version, @@version_comment
          251 Query SET NAMES 'utf8mb4' COLLATE 'utf8mb4_general_ci'
          251 Query SET lc_messages = 'de_DE'
          250 Query SELECT `config_data`, UNIX_TIMESTAMP(`timevalue`) ts FROM `phpmyadmin`.`pma__userconfig` WHERE `username` = 'root'
          251 Query SET collation_connection = 'utf8mb4_unicode_ci'
180709 11:52:52   251 Quit  
          250 Quit  
180709 11:52:53   252 Connect   pma@localhost as anonymous on 
          253 Connect   root@localhost as anonymous on 
          253 Query SELECT @@version, @@version_comment
          253 Query SET NAMES 'utf8mb4' COLLATE 'utf8mb4_general_ci'
          253 Query SET lc_messages = 'de_DE'
          252 Query SELECT `config_data`, UNIX_TIMESTAMP(`timevalue`) ts FROM `phpmyadmin`.`pma__userconfig` WHERE `username` = 'root'
          253 Query SET collation_connection = 'utf8mb4_unicode_ci'
          253 Query SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`, (SELECT DB_first_level FROM ( SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) DB_first_level FROM INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t ORDER BY DB_first_level ASC LIMIT 0, 100) t2 WHERE TRUE AND 1 = LOCATE(CONCAT(DB_first_level, '_'), CONCAT(SCHEMA_NAME, '_')) ORDER BY SCHEMA_NAME ASC
          252 Query SELECT `db_name`, COUNT(*) AS `count` FROM `phpmyadmin`.`pma__navigationhiding` WHERE `username`='root' GROUP BY `db_name`
          253 Query SELECT COUNT(*) FROM ( SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) DB_first_level FROM INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t
          253 Query SELECT COUNT(*) FROM ( SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) DB_first_level FROM INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t
180709 11:52:54   253 Quit  
          252 Quit  
          254 Connect   pma@localhost as anonymous on 
          255 Connect   root@localhost as anonymous on 
          255 Query SELECT @@version, @@version_comment
          255 Query SET NAMES 'utf8mb4' COLLATE 'utf8mb4_general_ci'
          255 Query SET lc_messages = 'de_DE'
          254 Query SELECT `config_data`, UNIX_TIMESTAMP(`timevalue`) ts FROM `phpmyadmin`.`pma__userconfig` WHERE `username` = 'root'
          255 Query SET collation_connection = 'utf8mb4_unicode_ci'
      254 Quit  
      256 Connect   pma@localhost as anonymous on 
      257 Connect   root@localhost as anonymous on 
      257 Query SELECT @@version, @@version_comment
      257 Query SET NAMES 'utf8mb4' COLLATE 'utf8mb4_general_ci'
      257 Query SET lc_messages = 'de_DE'
      256 Query SELECT `config_data`, UNIX_TIMESTAMP(`timevalue`) ts FROM `phpmyadmin`.`pma__userconfig` WHERE `username` = 'root'
      257 Query SET collation_connection = 'utf8mb4_unicode_ci'
      256 Query SELECT `config_data`, UNIX_TIMESTAMP(`timevalue`) ts FROM `phpmyadmin`.`pma__userconfig` WHERE `username` = 'root'
      256 Query SELECT `username` FROM `phpmyadmin`.`pma__userconfig` WHERE `username` = 'root'
      256 Query UPDATE `phpmyadmin`.`pma__userconfig` SET `timevalue` = NOW(), `config_data` = '\"lang\":\"de\",\"Console\\/Mode\":\"collapse\"' WHERE `username` = 'root'

180709 11:52:58 257 退出 第256章 放弃

【问题讨论】:

您找到这个问题的答案了吗?我在 MAMP 上遇到了同样的问题。 【参考方案1】:

我遇到了同样的问题并尝试了很多方法,尤其是增加php.ini 的时间限制,但没有任何效果。最后我完成了通过命令行导入 sql 文件的工作:

mysql -u username -p databasename < /path/to/file.sql

在大多数情况下,用户名只是root。如果您在旧数据库和新数据库备份文件中都有相同的表,那么您可能会收到如下错误:

ERROR 1050 (42S01) at line 31: Table 'wp_commentmeta' already exists

在这种情况下,删除(删除)现有数据库,然后通过上述命令导入新文件。

【讨论】:

【参考方案2】:

我在 MAMP 上遇到了同样的错误,我通过更改 php.ini 中的参数来解决

我听从了蒂米@enter link description here的指示

; Maximum size of POST data that PHP will accept.
post_max_size = 256M



; Maximum allowed size for uploaded files.
upload_max_filesize = 256M

; Maximum execution time of each script, in seconds
max_execution_time = 600     

; Maximum amount of time each script may spend parsing request data
max_input_time = 600

; Maximum amount of memory a script may consume (8MB)
memory_limit = 512M

注意 1:您可以用自己的值替换值,例如可以写 5000 代替 600

注意 2:重新启动 Xampp 或 MAMP。

【讨论】:

【参考方案3】:

使用命令行(CMD)https://youtu.be/gdyD3gFrahU 我用这种方式导入1.14G的数据库,如果你不想编辑你的PHP.ini文件,我建议你试试这种方式

【讨论】:

以上是关于导入 db phpMyAdmin - 错误格式参数不正确的主要内容,如果未能解决你的问题,请参考以下文章

如何通过ods从phpmyadmin导入mysql db中的前导零

将大型 .sql 文件导入数据库 - 重复超时错误 phPMYAdmin

cpanel中的Phpmyadmin导入数据库不起作用

无法使用 phpmyadmin 向导将 csv 导入 mysql 数据库

phpmyadmin 不允许导入/导出文件

通过phpmyadmin将csv文件导入mysql