I have created 2 droplets one for my frontend and another for my backend. I have linked both of them using the IP Address.
But When I am trying to make get request using Postman. It is throwing this error:
Error -> SequelizeConnectionError: Client does not support authentication protocol requested by server; consider upgrading MySQL client
And when I am trying to access it from my vue.js application. It is throwing this error: net::ERR_CONNECTION_REFUSED
Please help
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
Are you using the new DigitalOcean Managed MySQL service? If so you might have to create a new user with authentication type mysql_native_password or alter your doadmin user so that it does not use zcaching_sha2_passwordz but mysql_native_password. That way your node should be able to connect to the MySQL database.
You can take a look at this answer here on how to do that:
Also, I would recommend testing if you could connect from your backend droplet to your MySQL server using telnet:
telnet (^)mysql_server_ip(^) (^)mysql_port(^)
If the telnet command connects you fine, then it is not an issue with your firewall, so I would recommend that you share your config files here so that I could advise you further.
Regards, Bobby
The issues that are being encountered are common when setting up separate frontend and backend servers and trying to connect them to a MySQL database. Let’s break down the problems and the steps to resolve them.
This error typically occurs when the MySQL server is using a newer authentication protocol that the Sequelize or MySQL client library does not support. This is common with MySQL 8.0, which uses caching_sha2_password by default.
Upgrade Your MySQL Client:
caching_sha2_password authentication plugin.mysql2 package:npm install mysql2@latest
Change MySQL User Authentication Method:
mysql_native_password, which is compatible with older clients.Run these commands in your MySQL server:
ALTER USER 'your_username'@'%' IDENTIFIED WITH mysql_native_password BY 'your_password';
FLUSH PRIVILEGES;
Replace your_username and your_password with your actual MySQL username and password.
Check Sequelize Configuration:
This error usually occurs when the Vue.js frontend cannot reach the backend server. The causes can include:
localhost.Check if the Backend Server is Running:
You can check which ports are being listened to with:
sudo netstat -tuln | grep LISTEN
Bind Backend Server to All Interfaces:
0.0.0.0 rather than 127.0.0.1 so it can accept connections from external IPs.Example for Express.js:
app.listen(3000, '0.0.0.0', () => {
console.log('Server is running on port 3000');
});
Firewall and Security Groups:
ufw to open the port:sudo ufw allow 3000/tcp
Cross-Origin Resource Sharing (CORS):
Example for Express.js:
const cors = require('cors');
app.use(cors());
Testing with Postman:
ERR_CONNECTION_REFUSED, check if the backend service is running and reachable from the Postman client (which might be running on your local machine).0.0.0.0) so that it can accept connections from external IPs.Once you’ve gone through these steps, your Vue.js application should be able to communicate with your backend, and Postman should be able to successfully send requests to your backend API.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.