Error: connect ECONNREFUSED 127.0.0.1:3306 solved in Node JS Mysql

Error: connect ECONNREFUSED 127.0.0.1:3306 solved in Node JS Mysql


Error: connect ECONNREFUSED 127.0.0.1:3306 solved in Node JS Mysql

How to fix Error: connect ECONNREFUSED 127.0.0.1:3306 in node js and mysql is shown


Content

0.32 -> hi everyone in this video i will be showing you  
3.2 -> how to solve the error  connect econnrefused 127.0.0.1
8.96 -> 3306 so i am getting this error when i try to  connect my mysql database by using node.js and  
14.56 -> i will be showing you three possible ways how you  can solve this error so the first one is what you  
18.96 -> are doing is you need to go to services all right  just go to search and type services and just click  
24.08 -> on open and in the services dialog box just search  for m which is mysql i'll be having over here and  
32.4 -> you'll be having this mysql80 all right just  click it and you need to just start the service  
39.6 -> yeah the service has now started and you will  be having another mysql if it's automatic just  
44.24 -> leave it it's fine but if it is also manual just  start the service all right just leave it if it  
48.72 -> is automatic so after doing this just close  the services all right so now again come to  
54 -> the terminal of visual studio code and press  ctrl c to stop it and again rerun it so this  
60.56 -> time as you can see i'm getting on port 3000 and  connected this is because of the console over here  
65.6 -> which means that i'm not having any error so this  is the first way and if you're using xampp or any  
70.48 -> other like database or server please try starting  it okay and if this method doesn't work for you  
75.68 -> you need to go to your mysql connection okay this  create connection over here and what you are doing  
80.4 -> is instead of this host as localhost you need to  replace this localhost by this number 127.0.0.1  
87.92 -> you have to replace this and that's the second way  and if that also didn't work what you are doing is  
93.04 -> you have to add here another value port all right  and you just specify your port like for example  
99.12 -> i am having here 3001 you want to like specify  your unused port over here so that's the third  
104.56 -> way i hope this will solve you this issue in most  of the cases not starting the mysql service is  
109.76 -> the issue i hope this works and i hope you have  found this video useful mine is a programming  
114.64 -> channel i've done many videos in mysql node.js  react.js c c plus plus java python as well as 3d  
120.56 -> animation using blender so do check other videos  of my channel subscribe me thanks for watching

Source: https://www.youtube.com/watch?v=ErIostyFxCc