MariaDB connection with Sequelize

前端 未结 2 786
旧时难觅i
旧时难觅i 2021-01-22 19:44

I have been checking for the connectivity of MariaDB, with Sequelize.

const Sequelize = require(\'sequelize\');

// Setting up database (MariaDB) connection
cons         


        
2条回答
  •  日久生厌
    2021-01-22 20:15

    MariaDB For MariaDB compatibility you have to install the package mariasql@0.1.20, or higher. The configuration needs to look like this:

    var sequelize = new Sequelize('database', 'username', 'password', {
      dialect: 'mariadb'
    })
    

    Or Try this:

    MariaSQL: https://www.npmjs.com/package/mariasql

    A node.js binding to MariaDB's non-blocking (MySQL-compatible) client library.

    var Client = require('mariasql');
    
    var c = new Client({
      host: '127.0.0.1',
      user: 'foo',
      password: 'bar'
    });
    
    c.query('SHOW DATABASES', function(err, rows) {
      if (err)
        throw err;
      console.dir(rows);
    });
    
    c.end();
    

    MariaSQL is recommended.

提交回复
热议问题