the application I'm developing will have a database for each user, what I need is to create the database and the user from a script.sql or directly passing the commands "CREATE DATABASE", "CREATE USERS" CREATE TABLE" etc. i didn't find anything about this approach, only for an already existing and connected database, or to create the database from models, i would like to do it by my aspnet core api, both api and mysql are on the same server Linux. Thanks for any direction to go.
Asked
Active
Viewed 23 times
-1
-
Does this answer your question? [How and where to call Database.EnsureCreated and Database.Migrate?](https://stackoverflow.com/questions/38238043/how-and-where-to-call-database-ensurecreated-and-database-migrate) – Franz Gleichmann May 10 '22 at 07:54
-
this doesn't answer my question, as I said I'm not going to use migration, and I don't have the models to create the database using code-first, imagine I only have the database creation script, the server ip 123.123.1.123 username and password. – MariINova May 10 '22 at 12:00
-
`and I don't have the models to create the database using code-first` - if you have the database, you can automatically [scaffold](https://docs.microsoft.com/ef/core/managing-schemas/scaffolding?tabs=dotnet-core-cli) the model. or you could [execute arbitrary SQL in a migration](https://docs.microsoft.com/ef/core/managing-schemas/migrations/operations) – Franz Gleichmann May 10 '22 at 12:09
-
I need to create the database from another system/api and not from the system where the created base will be used. – MariINova May 10 '22 at 14:01