Well UBB has nothing to do with MYsql as far as servername,User Name and password.
You enter that info in ubb so it can access the database.
It is like giving ubb a login to the database.
So ubb did not change the db login it was just wrong in the config file
Phpmyadim is a standalone db tool which again has nothing to do with UBB.
So when you selected the connection settings something must have corrupted the ubb config file. Especially if you restored the old config file and it is working again.
So something was changed in the config file due to whatever reason. It was probably so slight and unobtrusive you overlooked it checking for errors.