How to normalize data en-masse?
This answer assumes that users.login is unique.


First, alter the users table to include an address_id column.
Next, if you add a addresses.login column you would then be able to do the following query after the insert into addresses:

UPDATE users, addresses SET users.address_id = addresses.address_id 
WHERE users.login = addresses.login

Finally drop the addresses.login column


An alternative would be to use an AFTER INSERT trigger on addresses to update the users table based on the unique address entries. Unfortunately, this assumes that all the fields of addresses combined represent a unique users.login, which for example would be invalid if a married couple each had logins but shared the same address.