How to automatically create a custom field when a post is published?

add_action('publish_post'. 'add_custom_field_automatically');

You have a period in the second add_action. This should be a comma 🙂

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