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
• 11,360 points
2,953 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,840 points

Related Questions In Data Analytics

+1 vote
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
• 10,620 points
2,089 views
0 votes
1 answer

How to connect to mysql database from rstudio?

Connect to the database as below. install.packages("odbc") db = ...READ MORE

answered Oct 7, 2019 in Data Analytics by anonymous
• 33,030 points
3,657 views
0 votes
1 answer
+1 vote
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,840 points
7,999 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
• 52,350 points
5,070 views
+2 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
• 52,350 points
9,563 views
+1 vote
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
• 52,350 points
690 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,840 points
3,123 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,840 points
1,233 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://cr ...READ MORE

answered Nov 26, 2018 in Data Analytics by Maverick
• 10,840 points
9,154 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP