<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dan Neamtu</title>
    <description>The latest articles on DEV Community by Dan Neamtu (@upsier).</description>
    <link>https://dev.to/upsier</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F303563%2F17f26cb9-6a16-4dea-806d-80910f74e82c.jpeg</url>
      <title>DEV Community: Dan Neamtu</title>
      <link>https://dev.to/upsier</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/upsier"/>
    <language>en</language>
    <item>
      <title>Node.js Error: connect ECONNREFUSED - how to connect Node with phpMyAdmin</title>
      <dc:creator>Dan Neamtu</dc:creator>
      <pubDate>Sun, 29 Dec 2019 22:35:43 +0000</pubDate>
      <link>https://dev.to/upsier/node-js-error-connect-econnrefused-how-to-connect-with-phpmyadmin-2ekb</link>
      <guid>https://dev.to/upsier/node-js-error-connect-econnrefused-how-to-connect-with-phpmyadmin-2ekb</guid>
      <description>&lt;p&gt;I spend more than 6 hours searching and testing, I get frustrated, angry and you know...  just for 3 minutes job.&lt;/p&gt;

&lt;p&gt;Here it's my success story with incredible persistant Node.js error &lt;strong&gt;connect ECONNREFUSED&lt;/strong&gt; .&lt;/p&gt;

&lt;p&gt;Day 1. &lt;br&gt;
I run this code, and should work fine. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fde.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fde.png" alt="Node Connection"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Oh, but no, some errors &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fd2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fd2.png" alt="Error: connect ECONNREFUSED"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Usual errors, maybe 3-4 minutes. I changed host: 'localhost' to host : '127.0.0.1', port: 8080, or maybe 8000, oh yes, 3306 this is. No, not that. Oh, yes, hostname: '127.0.0.1:3306'. No. Adding database, remove database. Change every thing I can now change. Nothing. &lt;/p&gt;

&lt;p&gt;"You should check if your XAMMP server is running", yes it is green. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fd3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fd3.png" alt="Error: connect ECONNREFUSED"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Maybe it is the port 8443. node app.js enter, connect ECONNREFUSED. no, it's not the port. No password, no root, no port. What can solve this?&lt;/p&gt;

&lt;p&gt;OOhh, yes, I know, I should thinking about that. Maybe I need to put the project in root XAMPP root folder. No. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;connect ECONNREFUSED&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;3 hours later. I need more music.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/3YxaaGgTQYM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Day 2&lt;br&gt;
Today, Sunday, with some first snow outside, I discovered something new. There is an IP address on my XAMPP, and maybe this is how I can solve the error. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fd4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fd4.png" alt="Error: connect ECONNREFUSED"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unfortunately it was not the case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Starting to find the real solution in my case&lt;/strong&gt;&lt;br&gt;
And after I read Yannick Motton's best answer on post &lt;a href="https://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server" rel="noopener noreferrer"&gt;host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server&lt;/a&gt; I found the solution. &lt;/p&gt;

&lt;h3&gt;
  
  
  The solution:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Create an user with password, and grant all provileges&lt;/strong&gt;&lt;br&gt;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';&lt;br&gt;
GRANT ALL PRIVILEGES ON &lt;em&gt;.&lt;/em&gt; TO 'username'@'localhost' WITH GRANT OPTION;&lt;br&gt;
CREATE USER 'username'@'%' IDENTIFIED BY 'password';&lt;br&gt;
GRANT ALL PRIVILEGES ON &lt;em&gt;.&lt;/em&gt; TO 'username'@'%' WITH GRANT OPTION;&lt;br&gt;
FLUSH PRIVILEGES;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fd5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fd5.png" alt="Error: connect ECONNREFUSED"&gt;&lt;/a&gt;&lt;br&gt;
This will set user: username and pass: password&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Change localhost with your XAMPP IP (and also add username/password for user and password)&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fd6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fd6.png" alt="Error: connect ECONNREFUSED"&gt;&lt;/a&gt;&lt;br&gt;
Change host: "localhost" to host:"192.168.64.2", and update with user: "username", password: "password". &lt;br&gt;
node app + enter &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fd7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.danneamtu.com%2Fuploadsimg%2Fd7.png" alt="Error: connect ECONNREFUSED"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Connection established&lt;/strong&gt; It's done. Hooray.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Celebrate the victory&lt;/strong&gt;&lt;br&gt;
Now that your terminal print Connection established, you whould celebrate the victory with dev friends.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1501238295340-c810d3c156d2%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D1050%26q%3D80" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1501238295340-c810d3c156d2%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D1050%26q%3D80" alt="Error: connect ECONNREFUSED"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Final thoughts
&lt;/h3&gt;

&lt;p&gt;Hope this article will help you to solve the connect ECONNREFUSED error and to connect Node.js with phpMyAdmin in just a few minutes.&lt;/p&gt;

&lt;p&gt;“Patience, persistence, and perspiration make an unbeatable combination for success.” - Napoleon Hill&lt;/p&gt;

</description>
      <category>xampp</category>
      <category>phpmyadmin</category>
      <category>javascript</category>
      <category>node</category>
    </item>
  </channel>
</rss>
