Introduce usage of mysqli API calls instead of deprecated mysql API.

closes: #1148