When I try to change the texture on a cube all of the cubes change
A material is its own data block, and a material can be applied to multiple objects.  So by modifying the material you see the effects everywhere that material is applied.
You must make a copy of the material and apply it to the object you want to change.