Setting up R to connect to MySQL/MariaDB

If you need R to connect to MySQL or getting the error below from your script:

Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/usr/local/lib/R/site-library/RMySQL/libs/RMySQL.so':
  libmysqlclient.so.18: cannot open shared object file: No such file or directory

Then it can be solved by these commands

R -i
install.packages("RMySQL")

You will get a question about choosing a mirror to get the package from, just choose the one nearest to you.

Leave a Reply

Your email address will not be published. Required fields are marked *

− 7 = 2