Avoid useless use of cat
Added database existence test for mysql