adding RMySQL package to R fails (on Windows)?

后端 未结 11 2546
予麋鹿
予麋鹿 2020-11-30 06:03

I can\'t figure out why my RMySQL package won\'t install - here\'s what I get:

> install.packages(\'RMySQL\',type=\'source\')
trying URL \'http://cran.mir         


        
11条回答
  •  粉色の甜心
    2020-11-30 06:43

    18 months later, new laptop, same problem. Returning to the scene of the crime - sorry January 2011 self; we're in the future, and this installation still isn't any fun.

    Lessons learned:

    -Updated RTools are essential. Get them.

    -Are you seeing an error along the lines of .onLoad failed in loadNamespace() for 'RMySQL', details? This seems to mean that there's a problem with your system environment variables.

    In R, run

    Sys.getenv('MYSQL_HOME')
    

    If it spits back a path like

     [1] "C:\\Program Files\\MySQL\\MySQL Server 5.6"
    

    you're good. But if it gives you empty string, you need to set this.

    These are all Windows 7 directions, but the process is pretty similar in XP, if memory serves.

    1) Bring up System Properties > Advanced > Environment Variables.

    2) In the lower 'System Variables' pane, click 'New'.

    3) Variable name is MYSQL_HOME and value is whatever the path is to your MySQL installation - mine was C:\Program Files\MySQL\MySQL Server 5.6

    Newer versions of MySQL don't seem to create an environment variable on install - that and the lack of binaries for RMySQL explain why this questions has garnered 8,000 hits.

    -Still stuck? Here are two additional in-depth writeups: 1, 2

提交回复
热议问题