Just trying to use getBM and keep running into this problem (see below). Anyone seen this. Not getting a fix by using host=www.ensembl.org. Let me know if anyone's seen this problem.
> library(biomaRt)
>
> listMarts()
biomart version
1 ENSEMBL_MART_ENSEMBL Ensembl Genes 91
2 ENSEMBL_MART_MOUSE Mouse strains 91
3 ENSEMBL_MART_SNP Ensembl Variation 91
4 ENSEMBL_MART_FUNCGEN Ensembl Regulation 91
> snpmart = useMart(biomart = "ENSEMBL_MART_SNP", dataset="hsapiens_snp")
> getBM(attributes = c('refsnp_id','allele','chrom_start','chrom_strand'),
+ filters = c('chr_name','start','end'),
+ values = list(8,148350,148612),
+ mart = snpmart)
Error in getBM(attributes = c("refsnp_id", "allele", "chrom_start", "chrom_strand"), :
Query ERROR: caught BioMart::Exception::Database: Could not connect to mysql database snp_mart_91: DBI connect('database=snp_mart_91;host=127.0.0.1;port=5316','ensro',...) failed: Lost connection to MySQL server at 'reading initial communication packet', system error: 0 at /nfs/public/release/ensweb/latest/live/mart/www_91/biomart-perl/lib/BioMart/Configuration/DBLocation.pm line 98.
Yes, I'm having the exact same issue. Have spent a few hours poking around and seen same issue had been reported over and over again over the years. Seems like the default mysql connection configuration has been constantly evolving. On enseml webpage (https://uswest.ensembl.org/info/docs/api/debug_installation_guide.html), it clearly states that the connection should be established this way:
mysql --host=ensembldb.ensembl.org --port=3306 --user=anonymous
I'm not sure why biomaRt had this hard-coded in the package, or it is just being me not able to figure out how to change it or explicitly call another routine for the mysql query?
biomaRt doesn't use the mysql interface to Ensembl directly, it queries via the RESTful XML interface described here (https://www.ensembl.org/info/data/biomart/biomart_restful.html). MySQL errors like these typically indicate some instability at the Ensembl end, rather than with the package.
OK, for whatever reason, it has just started working for me. Nothing was changed and everything seems to be fine. Don't know whether it was just because the mysql sever was down.
I had the same problem before but solved it after I re-load my ensembl.