Cory Walker
Cory Walker

Reputation: 4987

Allowed memory size exhausted during non-PHP MySQL import

When I try to import a large SQL backup using the command:

mysql -u ***** -p***** nxtpp < backup.sql

I get the following error message after the backup is partially executed:

Allowed memory size of 33554432 bytes exhausted

I already know about the memory_limit variable in php.ini, but the problem is that I am not using PHP to import, just the mysql command. How can I fix this? Could the problem have to do with the 128MB of memory the server has?

Edit: It turned out that the phpMyAdmin I was exporting from was producing the error. I could see the error's HTML in the actual dump file. When MySQL executed it, it just printed the error out.

Upvotes: 2

Views: 1695

Answers (2)

Justin
Justin

Reputation: 2924

Assuming like Peter Smit said that this isn't being run inside of a PHP script, try increasing your MySQL setting for key_buffer to something larger.

Warning: This is a key performance tuning setting, so change it carefully. Higher values will let MySQL consume much more of your machine's memory.

As an aside, this should be moved to http://serverfault.com when it goes live.

jpe

Upvotes: 0

Peter Smit
Peter Smit

Reputation: 28736

It looks like there is still php involved somehow. MySQL's error messages are looking different.

Are you maybe trying to execute this command with the exec() or system() statement in php? Then the memory_limit still applies.

Upvotes: 1

Related Questions