Skip to main content
Showing results for 
Show  only  | Search instead for 
Did you mean: 

mysql access from node.js using xdevapi

I am using a non-shared server where I installed Node.js and am trying to access my MySql database and am not having success.  I tried using both a legacy mysql package and the newer xdevapi interface and neither work. I can't find any documentation of how to use xdevapi or whether it is even supported on the GoDaddy mysql installations. Has anyone tried doing this? I'm using the @mysql/xdevapi npm module. It works perfectly on my local Windows install of MySql but not on GoDaddy.  The code logic I'm using is as follows:


    var mysqlx = require('@mysql/xdevapi');

    var config = {
            host: dbhost,
            port: 33060,
            schema: dbname,
            user: dbuid,
            password: dbpassword
    var mysession = mysqlx.getSession(config);
This gives an error saying can't connect. The user has privs set in cPanel. The host name is set to "localhost" and the port of 33060 is the default typically used by the xdevapi protocol.

Okay - so I'm answering my own question here.  I researched this and found out that GoDaddy's MySQL default install is the old version 5.7.32 which does not natively support the X plugin enabling the XDevApi calls. This is a new feature that is on by default in MySQL Version 8 and later. I did get the standard npmjs mysql library to work with the default 5.7.32 version, but it doesn't work with Version 8 which is what I have on my development Windows machine. I need both to be the same, so I downgraded my Windows machine to 5.7.32.  I opted to not upgrade the VPS server to 8 because I am afraid that might break the CPanel myPhpAdmin functionality. 


If anyone else has upgraded a VPS MySQL server to version 8 please let me know if that worked for you.