Correct way to output styles gathered from theme or plugin settings?

Yes, you would use wp_add_inline_style, as you showed in your question

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)