Checking a MySQL connection and refreshing it
As per this SO question you need to be aware that calling Close will not necessarily actually close the connection but only put it back into the connection pool.
There is no reason to do mySqlConnection = null;. You assign a new value to mySqlConnection in the next statement so setting it to null achieves nothing.
These docs might be somewhat out-dated but they state that you can call Close multiple times and that no exception is generated so you can probably skip the check and just call Close unconditionally.