How to pass menu slug as a variable to wp_nav_menu?

You want get_field() (which returns the value), not the_field() (which echo’s the value):

$var = get_field( 'menu2' );

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