//mysql.client 库 - 登录插件 import console; import mysql.client; //导入 caching_sha2_password 插件库(MySQL 8.0 默认登录认证方式) import mysql.plugin.cachingSha2Password; //其他可用的 MySQL 登录认证插件库: //import mysql.plugin.sha256Password //import mysql.plugin.ed25519 /* 可用下面的 SQL 切换到 mysql_native_password( 禁用 caching_sha2_password )。 ALTER USER '用户名'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码'; mysql_native_password 是 MySQL 内置的插件。 没有也不需要一个类似 mysql.plugin.nativePassword 的插件库。 */ console.showLoading(" 正在连接测试数据库" ) var dbClient,err = mysql.client( server = "db4free.net"; //数据库服务器,可省略默认为localhost uid = "aardio_mysql";//用户名,可省略默认为root pwd = "aardio.com"; ); if(!dbClient){ console.log("如果是有人无聊修改了密码,请自行到 db4free.net 申请免费数据库") return console.logPause(err); } console.pause();