Dubh
Dubh

Reputation: 55

MVC3 Read-Only MySql Connection String

I'm currently working in Visual Studio 2010. MVC3 project. I'm new to .NET MVC and the only experience I have so far is with an MVC3 EF Code First project (MSSQL DB).

I'm looking to create another project and connect to a MySQL database. I can connect to the db fine but the DB credentials I am using have full access (I don't have access to any other accounts). I only want to connect read-only. (The application is a kind of reporting app). The DB is a test one but I'm afraid I'll do something stupid and either persist data back that I don't want to or I'll drop the DB altogether. (Even though it's a test DB, other people are using it)Is there a way of making my connection read-only via the connection string? Can anyone point me in the right direction?

Kindest Regards

Upvotes: 0

Views: 4346

Answers (1)

Iridio
Iridio

Reputation: 9271

You have to create an account on mysql that have readonly permissions and then setup your connection string to use that account. This link should be a start

Another alternative, if you can't create a user, could be to create some views in the db and quering them. (I will not dive into the performance gain/loss)

Upvotes: 1

Related Questions