下载mysql的providor
在appsettings.json中配置连接字符串
"ConnectionStrings": { "MySql": "server=******;user=root;password=******;database=TourismMallMS" },
在startup中配置服务
services.AddDbContextPool<AppDbContext>(options => { options.UseMySql(Configuration["ConnectionStrings:MySql"], new MySqlServerVersion(new Version(8, 0, 25))); });