1

I'm trying to run a Perl script that updates a MySQL database from a third party remote server. Everything works fine on my home PC however I've just moved my setup onto AWS and I'm now getting an error from this line:

$dbh = DBI->connect("DBI:mysql:oncourt:127.0.0.1","root","root",{ RaiseError => 1, AutoCommit => 0 }) || die $DBI::errstr;

The error is:

DBI connect('oncourt:127.0.0.1','root',...) failed: Authentication plugin 'caching_sha2_password' cannot be loaded: The specified module could not be found.

I have had this error before when I moved machines and I solved it by adding a .mylogin.cnf file to C:\Users\<username>\AppData\Roaming\MySQL. However, this isn't working for me now - could it be anything to do with the fact that I'm now logged in as Administrator rather than a standard user?

Any ideas on how to solve this?

Jossy
  • 589
  • 2
  • 12
  • 36
  • 1
    Use [legacy authentication mode](https://medium.com/@crmcmullen/how-to-run-mysql-8-0-with-native-password-authentication-502de5bac661). – tadman Aug 17 '20 at 20:14
  • Thanks. Have tried this before and again now and makes no difference. I updated ```my.ini``` to read ```default-authentication-plugin=mysql_native_password```. Was there anything else I should have done? I have restarted the AWS instance. – Jossy Aug 17 '20 at 20:28
  • It's worth checking with `SHOW VARIABLES` to see if it stuck. – tadman Aug 17 '20 at 20:31
  • Might need a bit more info I'm afraid - relative newbie here. What is ```SHOW VARIABLES``` and what do I need to do with it? – Jossy Aug 17 '20 at 20:35
  • That's a command you can use to find out the current configuration of the server. You may be editing a config file which has no impact on the running server, so you need to connect (e.g. via `mysql` command-line tool) and confirm it's applied correctly. – tadman Aug 17 '20 at 20:37
  • Figured out I can just run it as a query via Workbench :) So ```default_authentication_plugin``` is set to ```mysql_native_password``` and it still doesn't work :( – Jossy Aug 17 '20 at 20:42
  • 1
    I followed the command line solution here; https://stackoverflow.com/a/50209363/11277108. Everything is working ok. Thanks for trying to help @tadman! – Jossy Aug 18 '20 at 04:58

0 Answers0