If you still have the problem that mqtt node credentials are not saved over a node red restart then I suggest doing the following.
Restart node-red by running
node-red-stop
node-red-start
leave the terminal open. Then enter the credentials in the MQTT node. This is what you mean presumably
Deploy it and then run
node-red-stop
node-red-start
again. Assuming that your credentials are not saved then copy/paste the full log here. Also run, in the .node-red directory
ls -l
and post that too.