Question

NOT_SUPPORTED_AUTH_MODE error when trying to connect via local lamba function

Hi,

I can connect to my DO managed DB via SQL workbench without issue. However, when I try and connect via my local lambda Node JS code, I receive the following error…

An Error… { Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client code: ‘ER_NOT_SUPPORTED_AUTH_MODE’, errno: 1251, sqlMessage: ‘Client does not support authentication protocol requested by server; consider upgrading MySQL client’, sqlState: ‘08004’, fatal: true }

… my mysql looks like so…

   mysql.createConnection({
        host     : removed_for_post,
        user     : process.env["DO_u"],
        password : process.env["DO_p"],
        port     : '25060',
        database : 'defaultdb',
        ssl_mode: 'REQUIRED',
        ssl  : {
            ca : fs.readFileSync('./ca-certificate.txt')
          }

… and I have updated to latest mysql library. I’ve also tried connecting without the ssl_mode and ssl options, same error message.

Any ideas?


Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

https://www.digitalocean.com/docs/databases/mysql/how-to/manage-users-and-databases/#password-encryption is the answer. I created a new user and used the Legacy – MySQL 5.x auth.