From time to time i have to insert really large files into MySQL. And sometimes there are problems because you don’t have access to the mysql command line utility from the server to issue the source command (this lets you import dumps or sql files). So you have to use phpMyAdmin or some other web based utility.
But also too often one runs into the barriers set by PHP, specifically the configuration directives from php.ini: upload_max_filesize, memory_limit and post_max_size. If these are not set to a decent value you won’t be able to upload really large files and phpMyAdmin will fail. If you have access to these then you can modify them and you will have the ability to upload the files.
But if not there is another solution. Open your config.inc.php from the phpMyAdmin directory and search for the following setting:
$cfg[‘UploadDir’]
If it is present then modify it to point to a directory within the phpMyAdmin directory (you can call it “uploads”) or if not you can add it. Something like this:
$cfg[‘UploadDir’] = ‘uploads’;
Then you have to make sure that the directory “uploads” exists in your phpMyAdmin installation directory.
That’s all, now when you want to import a file just upload it there (with an ftp client) in that folder and in phpMyAdmin at the import screen there will be a select with the sql files that exist in the directory. You can import this way really huge files.
2 comments
Hmmm, this is relevant to my interests.
If you deal with exceptionally large dumps you should check this out: http://www.rusiczki.net/2007/01/24/sql-dump-file-splitter/
You are cool :) thank you very very much.