How to increase memory size for phpmyadmin

2019-02-09 13:13发布

问题:

I am facing some problem when I am trying to import magento database on localhost. It just import 18 table but in actual it contain 383 approx table. It gives error given below

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 2089674 bytes) in /usr/share/phpmyadmin/libraries/import.lib.php on line 253

How this problem will configure. Is there need to change php.ini?

回答1:

use this :

c:\mysql\bin\> mysql -u username -p password database_name < filename.sql

to import using command line

or in php.ini

memory_limit = 256M

change this to some other larger value. But as Dan said using command line is preferable.



回答2:

phpMyAdmin has been blowing memory limits on me lately (and I wasn't even importing/executing large amounts of data) so I've just tried the following in my config.inc.php

$cfg['MemoryLimit'] = '128M';

https://docs.phpmyadmin.net/en/latest/config.html#cfg_MemoryLimit



回答3:

Try this http://dev.mysql.com/doc/refman/5.5/en/mysqlimport.html I was capable to import a 930 MB database.



回答4:

You can change php.ini as other answers have mentioned. It can be ok on you localhost. But on webserver with more virtualhost you probably don't want to increase memory limit for all hosts (that's what directive in php.ini does).

To increse memory limit only for given virtualhost edit virtualhost settings. For example:

<VirtualHost *:443>
   #your virtualhost settings
   php_value memory_limit 64M #place any number you need
</VirtualHost>

Or, you can place the same php_value into your .htaccess file, but your virtualhost must allow to change this values.



回答5:

I was the same problem with the migration of database.

Try to change configuration of export to build file with queries like this:

INSERT INTO tbl_name VALUES (1,2,3)

When I was creating queries like this one:

INSERT INTO tbl_name (col_A,col_B) VALUES (1,2,3), (4,5,6), (7,8,9)

queries were too big to allocate them in memory. When I changed it, there were a lot of small queries so there wasn't problem with memory.



回答6:

Use this :

Edit your php.ini file: Change

memory_limit = 256M