Welcome to the forums @DexterZ!
Just to make sure, are you meaning the material slots in the mesh? Like when you select a MeshInstance node there is multiple slots that need materials to be setup?
If so, then there is unfortunately no great way to set all the material slots in a MeshInstance at once through the Godot editor. You can speed up the process a bit by setting up the first material in the first slot, then clicking the dropdown and "copy", then paste the material into the other slots that need the material. You can also try seeing if setting the material override sets all the slots, but I think it only affects the first material slot (could be wrong though!)
Programmatically, you can do something like this to set all the slots to a single material:
extends MeshInstance
# make sure to set this in the editor by clicking the node
# and inputting it in the inspector. There should be a property
# called "Material to apply" once this script is attached.
export (Material) var material_to_apply
func _ready():
for slot_num in range(0, get_surface_material_count()):
set_surface_material(slot_num, material_to_apply)