title: rror: connect ENOENT /Applications/MAMP/tmp/mysql/mysql.sock
body: <p>i have a problem that i cant use mysql server. so i asked the solution in stackoverflow and other error was happend..</p>
  
  <pre><code>var mysql = require("mysql");
  var connection = mysql.createConnection({
    host: "127.0.0.1",
    user: "root",
    password: "111111",
    database: "opentutorials",
    socketPath: "/Applications/MAMP/tmp/mysql/mysql.sock"
  });
  
  connection.connect();
  
  connection.query("SELECT * FROM topic", function(error, results, fields) {
    if (error) {
      console.log(error);
    }
    console.log(results);
  });
  
  connection.end();
  </code></pre>
  
  <p>here is my code and the error</p>
  
  <p>Error: connect ENOENT /Applications/MAMP/tmp/mysql/mysql.sock
      at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)
      --------------------
      at Protocol._enqueue (/Users/junggri/Desktop/mysql/node_modules/mysql/lib/protocol/Protocol.js:144:48)
      at Protocol.handshake (/Users/junggri/Desktop/mysql/node_modules/mysql/lib/protocol/Protocol.js:51:23)
      at Connection.connect (/Users/junggri/Desktop/mysql/node_modules/mysql/lib/Connection.js:119:18)
      at Object. (/Users/junggri/Desktop/mysql/nodejs/mysql.js:11:12)
      at Module._compile (internal/modules/cjs/loader.js:778:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
      at Module.load (internal/modules/cjs/loader.js:653:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
      at Function.Module._load (internal/modules/cjs/loader.js:585:3)
      at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    errno: 'ENOENT',
    code: 'ENOENT',
    syscall: 'connect',
    address: '/Applications/MAMP/tmp/mysql/mysql.sock',
    fatal: true }</p>