0
1
I am trying to set up and test the MySQL X Protocol (related keywords: MySQLX, X Plugin, XDevAPI, Connector/Node.js) and it somehow doesn't run as expected.
I am running Windows 7 64 Bit with a MySQL 5.7 service. I have made sure the X Protocol is running and listening by executing the following commands (after installing MySQL Shell).
mysqlsh.exe -u root -h localhost --classic --dba enableXProtocol
Creating a Classic Session to 'root@localhost'
Enter password: ************************
Your MySQL connection id is 14
Server version: 5.7.19-log MySQL Community Server (GPL)
No default schema selected; type \use <schema> to set one.
enableXProtocol: X Protocol plugin is already enabled and listening for connections on port 33060
mysqlsh.exe -u root --sqlc -e "show plugins"
Enter password: ************************
+----------------------------+----------+--------------------+---------+---------+
| Name | Status | Type | Library | License |
+----------------------------+----------+--------------------+---------+---------+
| binlog | ACTIVE | STORAGE ENGINE | null | GPL |
| mysql_native_password | ACTIVE | AUTHENTICATION | null | GPL |
| sha256_password | ACTIVE | AUTHENTICATION | null | GPL |
| CSV | ACTIVE | STORAGE ENGINE | null | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | null | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | null | GPL |
| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_LOCK_WAITS | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_CMP | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_CMP_PER_INDEX | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_CMP_PER_INDEX_RESET | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_BUFFER_PAGE | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_BUFFER_PAGE_LRU | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_BUFFER_POOL_STATS | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_TEMP_TABLE_INFO | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_METRICS | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_FT_DEFAULT_STOPWORD | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_FT_DELETED | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_FT_BEING_DELETED | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_FT_CONFIG | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_FT_INDEX_CACHE | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_FT_INDEX_TABLE | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_SYS_TABLES | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_SYS_TABLESTATS | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_SYS_INDEXES | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_SYS_COLUMNS | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_SYS_FIELDS | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_SYS_TABLESPACES | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_SYS_DATAFILES | ACTIVE | INFORMATION SCHEMA | null | GPL |
| INNODB_SYS_VIRTUAL | ACTIVE | INFORMATION SCHEMA | null | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | null | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | null | GPL |
| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | null | GPL |
| ARCHIVE | ACTIVE | STORAGE ENGINE | null | GPL |
| BLACKHOLE | ACTIVE | STORAGE ENGINE | null | GPL |
| FEDERATED | DISABLED | STORAGE ENGINE | null | GPL |
| partition | ACTIVE | STORAGE ENGINE | null | GPL |
| ngram | ACTIVE | FTPARSER | null | GPL |
| mysqlx | ACTIVE | DAEMON | mysqlx | GPL |
+----------------------------+----------+--------------------+---------+---------+
However, the following command outputs nothing (I also checked the output manually without grep
):
E:\>netstat -a -b | grep 33060
Which is the main reason why I post this on SuperUser and not StackOverflow. I think it is not a programming error. For the sake of completeness I will include the small Javascript I have used to test my connection from Node.js inspired by the official database connection example.
const mysqlx = require('@mysql/xdevapi');
async function main()
{
const session = await mysqlx.getSession({
host: 'localhost',
port: 33060,
dbUser: 'test',
dbPassword: 'test',
});
console.log(session);
}
main().catch(function (error) { console.log("error caught in main routine\n", error); });
The output is the following:
$ node db.js
error caught in main routine
{ Error: All routers failed.
at Session._failover (E:\temporary\xdevapi\node_modules\@mysql\xdevapi\lib\DevAPI\Session.js:231:23)
at _properties.socketFactory.createSocket.then.then.then.then.catch.err (E:\temporary\xdevapi\node_modules\@mysql\xdevapi\lib\DevAPI\Session.js:271:27)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:169:7) errno: 4001 }
The MySQL server is running as a service on my computer. The database is working fine. Any ideas why MySQL thinks the plugin is listening, while it actually isn't? Or is the netstat
command I run not the right one for this job? How can I fix this problem?