title: NodeJS MySQL DB connection fail
body: <p>thank you in advance for the help.</p>
  <p>I am using nodejs v16.13.1 and mysql 5.7.37-cll-lve.
  my nodejs app is currently on my local machine and my mysql db is on a remote server. I want to connect to the remote mysql but, I keep getting this error:</p>
  <blockquote>
  <p>Access denied for user ''@'mylocalcomputerip' (using password: YES)</p>
  </blockquote>
  <p>I am using shared hosting btw.</p>
  <p>What is weird is that the user is not showing and I know it is correctly being used. as well the the connection trying to connect to my local ip despite me putting in my server ip.</p>
  <p>I tried using one of the nameservers and then it gives a timeout.</p>
  <p>this is how I am trying to connect to the remote db.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>createConnection(){
          const conn = mysql.createConnection({
              host: process.env.DB_HOST,
              username: process.env.DB_USERNAME,
              password: process.env.DB_PASSWORD,
              database: process.env.DB_NAME,
              port: process.env.DB_PORT
          })
  
          conn.connect(err =&gt; {
              if(err) throw err
              console.log("Connected")
          })
          return conn
      }</code></pre>
  </div>
  </div>
  </p>
  <p>The host is the shared ip.</p>
  <p>The username is the user I created to interact with the db.</p>
  <p>The password is the password for the username.</p>
  <p>The database is the database that I'm trying to connect to.</p>
  <p>The port is the default port 3306 for mysql dbs.</p>
  <p>Any kind of knowledge or insight to what I'm doing wrong or don't know about would be greatly appreciated</p>