Add_action not working in required file of functions.php

Of course there can be many reasons, but if you require ajax.php in functions.php above the hook with wp_enqueue_script( 'myJSScript' ...); – it will not work.

wp_localize_script()
Works only if the script has already been added.

function theme_enqueue_ajax(){
    //try to add wp_enqueue_script( 'myJSScript' ...); here
    wp_localize_script( 'myJSScript', 'ajaxUrl', array( 'url' => admin_url( 'admin-ajax.php' ) ) );
}
add_action( "wp_enqueue_scripts", "theme_enqueue_ajax");

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