I tried the following command and it was successful.
ogrinfo "MSSQL:server=servername; database=databaseName; User Id=XX; Password=YYYYY;"