How to repair permissions on /usr/local after accidentally changed?
Assuming you only changed the owner (as your command states), you can return everything back to root ownership by

chown -R root /usr/local


If you think you may need to fix the group ownership too, then this is better

chown -R root:wheel /usr/local