Is there any possibility of creating a database within MySQL from Java?
I'm only aware of the
String url="jdbc:mysql://localhost:3306/test";
Connection con = DriverManager.getConnection( url, "cb0", "xxx" );
syntax, but here you have to specify a database name in the 'url'.
How can I create a MySQL database when I only have a login name and password, but no knowledge about the existing databases?
解决方案Conn = DriverManager.getConnection
("jdbc:mysql://localhost/?user=root&password=rootpassword");
s=Conn.createStatement();
int Result=s.executeUpdate("CREATE DATABASE databasename");