Error saying " Failed to connect to database: Error: Lost connection to MySQL server at 'handshake"

0 votes

Hi I'm trying to connect R to a MySQL database by using the following code.

library(RMySQL) library(dbConnect) con<-dbConnect(dbDriver('MySQL'),user='root',password='pw',dbname='dbname',host='100.000.0.00')

R give back the following error:

Error in .local(drv, ...) : Failed to connect to database: Error: Lost connection to MySQL server at 'handshake: waiting for inital communication packet', system error: 138

Nov 12, 2018 in Data Analytics by Ali
• 10,450 points
360 views

1 answer to this question.

0 votes

try this:

library(RODBCext)
sqlString <- "Select * from yourtable or sql query ;"
dbhandle<- odbcDriverConnect('driver{SQLServer};server=Servername;database=databasename;trusted_connection=True')
data <- sqlExecute(dbhandle, sqlString, fetch = TRUE)
answered Nov 12, 2018 by Maverick
• 10,040 points

Related Questions In Data Analytics

0 votes
1 answer

R & MySQl : Error connecting to Database

Check the dbConnect's documentation, you must pass values ...READ MORE

answered Dec 14, 2018 in Data Analytics by Sophie may
• 9,530 points
148 views
0 votes
1 answer
0 votes
1 answer

Error saying cannot open file 'file.pdf' when trying to save a plot in ggplot

You could try adding the following line ...READ MORE

answered Nov 9, 2018 in Data Analytics by Maverick
• 10,040 points
354 views
0 votes
1 answer

Error saying "duplicate 'row.names' are not allowed" when trying to setup my data for the mlogit-package

Take out the chid.var argument in your call to mlogit.data, ...READ MORE

answered Nov 12, 2018 in Data Analytics by Maverick
• 10,040 points
247 views
0 votes
1 answer

": cannot open the connection" Error in R

There can be two reasons for this ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 39,310 points
374 views
0 votes
1 answer

“subscript out of bounds” Error in r programming

This error is likely to occur when ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 39,310 points
1,170 views
0 votes
1 answer

What does “replacement has” Error mean?

This error occurs when one tries to ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 39,310 points
37 views
0 votes
1 answer

Errors saying "Error: unexpected '}' in "}"

This is a syntax error: Enclose your if ...READ MORE

answered Nov 8, 2018 in Data Analytics by Maverick
• 10,040 points
326 views
0 votes
1 answer

Error saying "Failed to get an access token." when trying to access my Google Analytics API

Try this: library(RGoogleAnalytics) oauth_token <- Auth( client.id = ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,040 points
71 views
0 votes
1 answer

Error saying " cannot open the connection" when trying to install a package in R

Try install.packages(“package_name”, repos="http://cran.us.r-p ...READ MORE

answered Nov 26, 2018 in Data Analytics by Maverick
• 10,040 points
269 views