Title: Remote database connection refused ERROR 2002
Last modified: October 4, 2021

---

# Remote database connection refused ERROR 2002

 *  Resolved [Joesurf](https://wordpress.org/support/users/joesurf/)
 * (@joesurf)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remote-database-connection-refused-error-2002/)
 * We are struggling with the use of WP Data Access / Data Explorer.
 * Remote database connection refused ERROR 2002
 * Our Connection detail are as follows:
 * Database name: cms_client_cfg
    MySQL host: cmwebvideo.compumove.com MySQL username:
   cmwebvideo MySQL password: ••••••••••• MySQL port: 1433 MySQL schema: db_datareader
 * We also attempted a WordPress test of wpdb by adding this string to our function.
   php file…
 * `$wpdb2 = new wpdb( ‘cmwebvideo’, ‘db password’, ‘cms_client_cfg’,
    ‘cmwebvideo.
   compumove.com’); $rows = $mydb->get_results( ‘SELECT field_name FROM table_name’);
 * foreach ( $rows as $row ) :
    echo $row->field_name; endforeach;
 * The result was a login error of [https://www.compumove.com/wp-admin/](https://www.compumove.com/wp-admin/)
 * Your help would be greatly appreciated. Thank you
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fremote-database-connection-refused-error-2002%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remote-database-connection-refused-error-2002/#post-14937386)
 * Hi [@joesurf](https://wordpress.org/support/users/joesurf/),
 * You are trying to connect to port 1433. Is this a SQL Server? Class wpdp can 
   only connect to MySQL. Can you connect from the MySQL CLI with these settings?
   Can you try?
 * Also, this will not work:
 *     ```
       $wpdb2 = new wpdb( 'cmwebvideo', 'db password', 'cms_client_cfg',
       'cmwebvideo.compumove.com');
       ```
   
 * You cannot use class wpdb to connect to a remote database defined in WP Data 
   Access. You could use class WPDADB, but you’ll need to make sure the WP Data 
   Access classes are loaded first.
 * Please let me know…
 * Best regards,
    Peter
 *  Thread Starter [Joesurf](https://wordpress.org/support/users/joesurf/)
 * (@joesurf)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remote-database-connection-refused-error-2002/#post-14940770)
 * This is a SQL Server on port 1433. We are able to it with these settings. I guess
   the error is that this is not a MySQL database.
 * My only experience in accessing a MySQL database is over our C-Panel using phpMyAdmin.
 * I am willing to try to use class WPDADB. Where do we obtain the WP Data Access
   classes and where do we load them?
 * Thank you for your help. Much appreciated.
 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remote-database-connection-refused-error-2002/#post-14942985)
 * Hi [@joesurf](https://wordpress.org/support/users/joesurf/),
 * Here is a minimal code fragment that shows how to use WPDADB:
    [https://code-manager.com/code/?wpda_search_code_name=Execute%20query%20from%20PHP%20shortcode](https://code-manager.com/code/?wpda_search_code_name=Execute%20query%20from%20PHP%20shortcode)
   Make sure you execute the code after loading WP Data Access. If you execute it
   to early, the class will not be found.
 * Please note that you cannot directly connect to SQL Server. WPDADB only connects
   to MySQL and MariaDB. You need the link I previously send to create a proxy to
   SQL Server. This works with MariaDB only. MySQL does not support this feature.
 * Hope this helps,
    Peter

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Remote database connection refused ERROR 2002’ is closed to new replies.

 * ![](https://ps.w.org/wp-data-access/assets/icon-256x256.png?rev=3299063)
 * [WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards](https://wordpress.org/plugins/wp-data-access/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-data-access/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-data-access/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-data-access/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-data-access/reviews/)

## Tags

 * [wpdb](https://wordpress.org/support/topic-tag/wpdb/)

 * 3 replies
 * 2 participants
 * Last reply from: [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/remote-database-connection-refused-error-2002/#post-14942985)
 * Status: resolved