MySQL Database

Fix “No data was received to import…” in phpMyAdmin with IIS

I have Windows 2008 R2 VPS & already installed IIS v7.5, PHP & MySQL.

I move some of my websites to this new VPS & try to import MySQL database via phpMyAdmin. I was greeted with following error.

No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16.

FAQ 1.16 does not help because it only says that my upload database size is too big. I only try to import 5kb database way below the limit.

Further digging reveal that the problem caused by the temporary directory PHP uses for uploads. By default this is C:\Windows\Temp, which is not writable for PHP.

To solve this,

1. Edit “php.ini” file & change

upload_tmp_dir="C:\Windows\temp"

to

upload_tmp_dir="C:\inetpub\temp"

2. Make sure to remove any other “upload_tmp_dir” settings.

3. Set permissions on “C:\inetpub\temp” so that IUSR and IIS_IUSRS have write permission.

4. Restart the web server (IIS)


How to do Bulk Replacement of WordPress SQL Database

Imagine that you have many similar typo errors in 100′s of your post such as ”[email protected]” text. The text is very important that you have to correct it with “[email protected]”.  Are you going to edit all your 100′s post one by one?

Trust me, it won’t be fun. Fortunately, there is an easy way to do bulk data replacement in WordPress SQL database. Some people call it “Search & Replace” method.

Remember to backup your database prior doing this.

To do this simple log in to PHPMyAdmin. Select the correct database & click on SQL tab. Use the following code to do the bulk replacement.

UPDATE wp_posts SET post_content = REPLACE (
post_content,
"TEXT TO REPLACE",
"REPLACEMENT TEXT");

Change “TEXT TO REPLACE” with your old text to be replaced & “REPLACEMENT TEXT” with your new text. Remember to leave the open & close quote.