我有一个要加载到我的 Azure/Node 服务器的架构:
USE mydatabase;
CREATE TABLE users(
id BIGINT NOT NULL AUTO_INCREMENT,
first_name VARCHAR(40),
last_name VARCHAR(40)
created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY(user_id)
)
当服务器使用 node-mysql 连接时,它会显示ER_NO_SUCH_TABLE
.
关于如何进行的任何建议?
编辑:这是节点代码:
const mysql = require("mysql")
function connectToDB () {
const connection_params = {
host: process.env.db_host || "localhost",
user: process.env.db_username || "root",
password: process.env.db_password || "",
database: process.env.db_database || "test_database"
}
const connection = mysql.createConnection(connection_params)
connection.connect(console.log)
return connection
}
module.exports = connectToDB