how to use media library [closed]

Take a look at wp_enqueue_media funciton. It enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs.

Then you can execute wp.media function:

  var button = document.querySelector('.button');

  button.addEventListener('click', function(e) {
    e.preventDefault();

    var frame = wp.media({
      title: 'Frame title',
      multiple: false
    });

    frame.on('select', function () {
      var attachment = frame.state().get('selection').first().toJSON();

      alert(attachment.url);
    });

    frame.open();
  });

More detailed guide: https://codex.wordpress.org/Javascript_Reference/wp.media

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