My plugin does not install correctly if a previous version is still installed

Quick and easy.

if ( is_plugin_active( 'plugin-folder-name/main-plugin-file.php' ) )
    deactivate_plugins( '/plugin-folder-name/main-plugin-file.php' );

It’s important to note the is_plugin_active string is slightly different than the deactivate_plugins string.

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