After I did a factory reset on my phone, my phone memory card locked. How should I unlock it?
Some phones like to lock the storage card with a code, usually the PIN or security code. So if you get asked to unlock it try those two – otherwise you can only wipe the card and reformat it.
For more help we'll need more information as Hovsep already asked.
Which phones? Most SD cards are formatted FAT32 (which is why Google doesn't allow SD card slots on Nexus and Moto devices - Google is so afraid the filesystem will get corrupted). I've never heard of a device that would encrypt a card with a PIN/security code.
Howard, if you go into settings, security, abd click on Encrypt External SD, it requires a password of at least six characters with at least one number. Thus would mean that the card would need a security or PIN code to unlock the micro SD/external SD card. Scroll down to "Encrypting your Android" section for more information: http://www.androidauthority.com/how-to-encrypt-android-device-326700/.
You can try the methods mentioned here (yes, they are for flash/pen drives, but work for SD cards as well): //www.makeuseof.com/answers/can-unlock-phone-memory-card/.
Also, try the methods mentioned here: http://www.tomshardware.com/forum/296914-32-remove-write-protection-micro-card.
You can also try to place the SD card into an adapter (micro SD to SD) and flip the switch from lock to unlock to see if it works (try it in the computer with the lock enabled, and then with it unlocked).
I've never seen a microSD card with a locking switch; they're just too small. It's more likely that the phone has encrypted the card, in which case reformatting may be the only answer.
That's why I said to place the micro SD into a standard SD card adapter, and move the switch on the adapter. From there, place it in a computer to read the card. If it is the internal storage SD, then it may be corrupt and needs warranty repair.
which phone and OS?