Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 683019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:39:39+00:00 2026-05-14T01:39:39+00:00

Is it possible to setup ASP.NET MVC 2 to work with a MySQL database?

  • 0

Is it possible to setup ASP.NET MVC 2 to work with a MySQL database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:39:39+00:00Added an answer on May 14, 2026 at 1:39 am

    I’m assuming that you have Visual Studio Professional 2008, have access to an instance of MySQL server, and have moderate to advanced development experience. This MAY work with VS2008 Web edition, but not at all sure.

    1. If you haven’t, install MySQL Connector for .NET (6.2.2.0 at the time of this write-up)
    2. Optional: install MySQL GUI Tools
    3. If you haven’t, install MVC 2 RTM, or better yet, use Microsoft’s Web Platform Installer. (UPDATE: MVC 2 has now been released for quite some time)
    4. Create an empty MySQL database. If you don’t want to access your application with the MySQL root user account (insecure), create a user account and assign the appropriate privileges (outside the scope of this write-up).
    5. Create a new MVC 2 application in Visual Studio
    6. In the MVC 2 app, reference MySql.Web.dll. It will either be in your GAC, or in the folder that the MySQL Connector installer put it.
    7. Modify the connection strings portion of your web.config:

        <connectionStrings> 
          <remove name="LocalMySqlServer"/> 
          <add name="MySqlMembershipConnection"
               connectionString="Data Source=[MySql server host name];
                                 userid=[user];
                                 password=[password];
                                 database=[database name];" 
               providerName="MySql.Data.MySqlClient"/>
        </connectionStrings>
      

      8.

      Modify the membership portion of your web.config:

        <membership defaultProvider="MySqlMembershipProvider"> 
          <providers>  
            <clear/>  
            <add name="MySqlMembershipProvider"  
                 type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, 
                       Version=6.2.2.0, Culture=neutral, 
                       PublicKeyToken=c5687fc88969c44d"  
                 connectionStringName="MySqlMembershipConnection"  
                 enablePasswordRetrieval="false"  
                 enablePasswordReset="true"  
                 requiresQuestionAndAnswer="false"  
                 requiresUniqueEmail="true"  
                 passwordFormat="Hashed"  
                 maxInvalidPasswordAttempts="5"  
                 minRequiredPasswordLength="6"  
                 minRequiredNonalphanumericCharacters="0"  
                 passwordAttemptWindow="10"  
                 applicationName="/"  
                 autogenerateschema="true"/>  
            </providers>  
          </membership>  
      

      9.

      Modify the role manager portion of your web.config:

        <roleManager enabled="true" defaultProvider="MySqlRoleProvider">  
          <providers>  
            <clear />  
            <add connectionStringName="MySqlMembershipConnection"  
                 applicationName="/"  
                 name="MySqlRoleProvider"  
                 type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, 
                       Version=6.2.2.0, Culture=neutral, 
                       PublicKeyToken=c5687fc88969c44d"  
                 autogenerateschema="true"/>  
          </providers>  
        </roleManager>
      

      10.

      Modify the profile portion of your web.config:

        <profile>  
          <providers>  
            <clear/>  
            <add type="MySql.Web.Security.MySQLProfileProvider, MySql.Web, 
                       Version=6.2.2.0, Culture=neutral, 
                       PublicKeyToken=c5687fc88969c44d"  
                 name="MySqlProfileProvider"  
                 applicationName="/"  
                 connectionStringName="MySqlMembershipConnection"  
                 autogenerateschema="true"/>  
          </providers>  
        </profile>
      

    At this point, you ought to be able to run the app and have the default ASP.NET MVC 2 home page come up in your browser. However, it may be a better idea to first run the ASP.NET Web configuration Tool (in Visual Studio top menus: Project -> ASP.NET Configuration). Once the tool launches, check out each of the tabs; no errors = all good.

    The configuration tool at Nathan Bridgewater’s blog was essential to getting this working. Kudos, Nathan. Look for the “Configuration Tool” heading half way down the page.

    The public key token on the MySql.web.dll that I’ve posted here ought not change any time soon. But in case you suspect a bad token string from copying and pasting or whatever, just use the Visual Studio command line to run: “sn -T [Path\to\your.dll]” in order to get the correct public key token.

    There you have it, ASP.NET MVC 2 running over MySQL. Cheers!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.