账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    小程序里knex操作腾讯云的云数据库MySQL,总是出错,求解
    29
    0

    如下,我自己单独尝试连接mysql和腾讯暴露的接口连接都不行,求大神帮忙指导下。
    另外,我将后端代码上传到腾讯云上面了,如何查看后端代码console.log的打印数据?

    module.exports = async (ctx, next) => {
    
      if (ctx.state.$wxInfo.loginState === 1) {
      
        /*const { mysql: config } = require('../config');
        var knex = require('knex')({
          client: 'mysql',
          connection: {
            host: config.host,
            port: config.port,
            user: config.user,
            password: config.pass,
            database: config.db,
            charset: config.char,
            multipleStatements: true
          }
        });
        knex('question_sort').select('id').then(res => {
           console.log(res)
          ctx.state.data = res;
        })*/
        
        const { mysql } = require('../qcloud')
        mysql('question_sort').select('id').then(res => {
          ctx.state.data = res;
        })
        
      } else {
        ctx.state.code = -1
      }
    }
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 离人未归 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部