gpt4 book ai didi

mysql - 无法使用 Wakanda 的远程连接连接到 MAMP MySQL 数据库

转载 作者:行者123 更新时间:2023-11-28 23:28:50 27 4
gpt4 key购买 nike

我正在尝试从 Wakanda 11 连接到 MAMP MySQL 数据库。

我尝试使用连接到远程数据存储 连接到本地主机数据库,但我一直收到连接失败 响应。我也尝试过使用它连接的端口 127.0.0.1:8081 但在尝试使用 port:3306 时没有尝试,这是我在MAMP 服务器。我做错了什么?

我试过以下脚本...

model.addSQLCatalog("mysqldb", {
hostname: '127.0.0.1',
port: 3306,
user: 'root',
password: 'xxxxxxxx',
database: 'my_database_name',
ssl: false,
dbType: 'mysql'
});

...但这给了我以下错误:

TypeError: JSON.stringify cannot serialize cyclic structures.

如何修复并使其在端口:3306 上工作以便我可以看到我的数据库结构?

最佳答案

如果您使用的是 Wakanda Enterprise Edition 11 或更高版本,则有一个 MySQL Connector Pro .

这是一个连接的例子:

model.mergeSQLCatalog(localName, {
hostname: string 'host name',
port: number remote_port_number,
user: string 'userName',
password: string 'password',
database: string 'SQL database name',
jsFile: string 'configuration JavaScript file',
ssl: boolean true or false,
dbType: string 'mysql' } )

如果您使用的是旧版本的 Wakanda Enterprise Edition 但仍在使用版本 7 或更高版本,那么会有一个 Wakanda/MySQL connector .

以下是使用连接器连接到 MySQL 的示例:

var sql = require('waf-sql');
//use port 3306 and do not use SSL
var dbconn = sql.connect('mysql','192.168.0.21', 'john', 'x54?hsf5x!','arts',3306,false);
var rs = dbconn.update("people", {
name: "smith",
age: 42
}, {
id: 1
});
var rs = dbconn.select("*", "people", {
id: 1
});
var row = rs.getNextRow(); // get the first row
dbcon.close(); // close connection

以下是可用参数的示例:

var params = {
hostname: [your host name or IP address],
user: [the user name of your DB],
password: [the user password],
database: [the DB name],
port: [the port number of the MySQL Server, by default 3306],
ssl: false,
dbType : 'mysql'
};

关于mysql - 无法使用 Wakanda 的远程连接连接到 MAMP MySQL 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38128937/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com