Custom query – get_the_terms not work

I’m not sure exactly how you want 'term_single' formatted, but you can amend the below as required if it’s not quite what you are looking for.

I’d also suggest not using the name $posts for your array, as I believe that WP has a global of the same name, so it could cause funkyness that is undesirable.

Finally, as you were in The Loop you can use simple functions to get all of the info that you require (ID, name, etc.) – check out the Codex.

$query = new WP_Query($criterias);
if($query->have_posts()) : while ($query->have_posts()) : $query->the_post();

        /** Get all terms (as objects) from the 'idm_real_tax' taxonomy that are associated with this Post */
        $terms = get_the_terms(get_the_ID(), 'idm_real_tax');

        /** Check that '$terms' is not empty */
        if($terms && !is_wp_error($terms)) :    // It's not...

            $term_names = array();  // Pre-stage to avoid errors

            /** Loop through each term object and add just the name to the '$term_names' array */
            foreach($terms as $term) :
                $term_names[] = $term->name;
            endif

            /** Join all of the term names together to make a comman seperated string of term names */
            $term_names_string = (!empty($term_names)) ? join(", ", $term_names) : '';

        endif;

        $my_posts[] = array(
            'id'                => get_the_ID(),
            'permalink'         => get_permalink(),
            'title'             => get_the_title(),
            'excerpt'           => get_the_excerpt(),
            'thumbnail'         => get_the_post_thumbnail(get_the_ID(), 'carrousel-realisation'),
            'pager_thumbnail'   => get_the_post_thumbnail(get_the_ID(), 'thumbnail', array('class' => 'img-thumbnail img-responsive')), 
            'term_single'       => $term_names
        );

    endwhile;
endif;

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