繁体   English   中英

我无法从 VS Code 连接到 MySQL Workbench 数据库

[英]I can`t connect to MySQL Workbench database from VS Code

我正在尝试在 ReactJS 上使用 CRUD 进行培训期间,从 VS Code 的 MySQL Workbench 中的数据库中添加一个条目。 但没有任何效果。 所有名称和符号都匹配。 重新加载页面时,应将一个条目添加到数据库中。 我按下“执行脚本的选定部分”,但没有任何反应。 不会抛出任何错误。 有没有人遇到过类似的问题? MySQL 8.0, Windows 10. 文件 index.js

    const express = require("express")
    const app = express()
    const mysql = require("mysql")
    
    const db = mysql.createConnection({
        host: "localhost",
        user: "root",
        password: "123456",
        database: "gamedb",
    })
    
    app.get('/', (req, res) => {
        const sqlInsert = "INSERT INTO gamestab (gamename, gamedes) VALUES ('Diablo', 'Diablo is an action role-playing dungeon crawler video game series developed by Blizzard North.');"
        db.query(sqlInsert, (err, result) => {
            res.send('hello');
        })
    
    });
    
    app.listen(3001, () => {
        console.log('running 3001')
    })

问题解决了。 I completely reinstalled MySQL, checked the MySQL80 operation in the services, specified the path to the System32 folder in PATH, replaced the chcp.com file from SysWOW64 to System32 (I had to set full user access to C drive Security), wrote the script :

ALTER USER 'root'@'localhost' IDENTIFIED BY 'password'
flush privileges; 

在 System Profile 选项卡的 Manage Server Connection 中,我指定了系统和路径,在 VS Code 中,我连接了 MySQL 管理工具。 这似乎就是一切。 结果,它仍然没有连接,没有通过后端进行任何条目。 最后,以某种随机的方式,一切正常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM