I want to create a connection with root of mysql for access all databases.
Thanks in advance
I want to create a connection with root of mysql for access all databases.
Thanks in advance
Leaving aside that using the root
account for something different than administrative purposes might be a bad idea ... well, still, you cannot connect to "all databases", at least not at once. What you can do is:
mysql
for a start, as you can be sure this one exists)connection.setCatalog(String)
method of the java.sql.Connection
class to switch to a different database. If you want to know which databases exist, see this question: how to get list of Databases "Schema" names of MySql using java JDBC