I'm trying to connect to remote publicly-accessible MySQL server EnsEMBL public server using RMySQL
, but when I try to list the tables, an error occurs:
library(RMySQL)
mydb = dbConnect(MySQL(),
user = 'anonymous',
port = 5306,
host = 'asiadb.ensembl.org')
dbListTables(mydb)
Error in .local(conn, statement, ...) :
could not run statement: No database selected
Is there a a way to find out the name? Or Am I making a completely different mistake altogether?
The error no database selected frequently occurs in MySQL when you perform a statement without selecting a database first. You need to replace [database_name] with the name of a database that exists in your MySQL server.
Error 1046 occurs when we miss to connect our table with a database. In this case, we don't have any database and that's why at first we will create a new database and then will instruct to use that database for the created table.
MySQL no database selected is an error that occurs when you execute a statement without first selecting a database. The database may be completely missing, or you may choose the wrong database if there is more than one database.
Now, we can choose any database. Suppose I am using the database 'business', therefore we can choose with the help of 'use' command. After using database 'business', we can create the above table and we will not get any error.
You have to specify the name of the db in the dbConnect call. e.g. :
mydb = dbConnect(MySQL(),
user = 'anonymous',
port = 5306,
host = 'asiadb.ensembl.org',
db = 'homo_sapiens_core_83_38')
dbListTables(mydb)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With