custom post type parsed as attachment

Finally I found the solution myself.In case you are also having similar problem, add the following two lines

  global $wp_rewrite;
  $wp_rewrite->flush_rules(); 

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