How do I rename an attribute code in Magento?

You can edit it in mysql at eav_attribute.attribute_code. Be sure to take backups prior and re-index all in System>Index Management afterwards.


if you have access to the database, you can run this SQL command

UPDATE eav_attribute
SET   attribute_code = 'your_NEW_attribute_code'
WHERE attribute_code = 'your_OLD_attribute_code'

don't forget to re-index and edit your sql codes afterwards


It is much easier to use an upgrade script with the following content for that:

$installer = $this;
$installer->startSetup();
$installer->updateAttribute('catalog_product', 'old_attribute_code', array('attribute_code' => 'new_attribute_code'));
$installer->endSetup();