With …
db = New mySQLCommunityServer
db.Connect
… we can connect to an existing database.
Is it possible to create a database and if so, how?
With …
db = New mySQLCommunityServer
db.Connect
… we can connect to an existing database.
Is it possible to create a database and if so, how?
you can connect to a MYSQL Database and use SQLExecute to run commands like CREATE DATABASE.
Dim db As New MySQLCommunityServer
db.Host = “127.0.0.1”
db.UserName = “user”
db.Password = “password”
if db.connect then
Dim ps As MySQLPreparedStatement = db.Prepare(“create database test”)
ps.SQLExecute
end if
I wouldn’t do it, actually. The only reason would be as part of a deployment routine. And then you might facing a DBA who simply rejects your request to grant you the required “create” right. Reason is that the admin would have to grant you a global right for it. More usually, the DBA would create the schema for you, limit your access to that schema and then would ask you for a deployment user (who is granted create, drop, etc rights) while your application user would be confined to “insert, update, delete” etc.
FYI, you do not “connect to a database”. You connect to a database service. You then select a database. Alternately, you can specify the database when you connect, But in either case, you can still select a different database, or create one, if you wish.
Found out what went wrong. I tried to make a second connection with a second db-object.