6

I have the following connection string in a web.config file to connect to MS Sql database.

<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Server=developer\SqlExpress;Integrated Security=True;Database=mydb" providerName="System.Data.SqlClient"/>

I have MS SQL server and MySQL server on the same machine. When I try to run the application I get the following error in the line 285 in the machine.config file.

Error:

Parser Error Message: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'localhost' (using password: NO)

<add name="MySqlSiteMapProvider"  type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />

The error is related to mySQL but I am trying to connect MS SQL.

How can I solve the problem?

Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275
Abdul Gafoor M
  • 107
  • 1
  • 3
  • 9

8 Answers8

10

This problem occurs when you install Mysql with MySql Connector Net. When Mysql Connector Net installed your computer, it configures your "machine.config" according to your .net version.

There are couple of ways to solve it.

1) You can add <clear /> tag in your provider. "Machine.config" overrides your custom provider, so to disable this we add <clear /> tag in your project web.config.

 <siteMap defaultProvider="SitefinitySiteMap">
  <providers>
    <!-- This line added. -->
    <clear />
    <add name="SitefinitySiteMap" type="Telerik.Sitefinity.Web.SitefinitySiteMap, Telerik.Sitefinity" />
  </providers>
</siteMap>

2) Second way is little bit tricky and if you use Mysql with .net, this might cause error on your projects.

Firstly, you need to find location of "machine.config". You can get more information here: https://stackoverflow.com/a/2325492/3801977

In my case, location is:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config

Open your "machine.config", and find following line and remove it:

<siteMap>
  <providers>
    <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=8.0.13.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
  </providers>
</siteMap>
Yigit Yuksel
  • 1,060
  • 2
  • 18
  • 35
8

"Remove" the MySqlSiteMapProvider provider in your web.config like this:

<siteMap>
  <providers>
    <remove name="MySqlSiteMapProvider" /> <!-- add this line -->
  </providers>
</siteMap>
Taylor Brown
  • 1,689
  • 2
  • 17
  • 33
Sam Zakhezin
  • 366
  • 1
  • 8
  • Thanks, I was trying to run sharepoint server 2019 admin page after install and i got this error, i have multiple sites hosted on the same server and some are PHP based and requires mysql so on the same server i have Microsoft SQL Server 2019 and Mysql, looks like ASP.NET based websites from MS doesn't like mysql ;) i'm still learning IIS and this answer helped me a lot ! Note: the tag was added to the config already and it didn't solve the problem, only that answer worked for me. – jiciftw Jan 29 '21 at 20:10
1

The problem is not with connecting to SQL Server. The problem is that your configuration file finds an entry with the name MySqlSiteMapProvider that tries to connect to my SQL Server, and it fails. I don't know what this provider is used for, but you must remove it, and its usages from your appilcation code, or update it, so that it uses SQL Server instead of the missing or misconfigured mySql.

JotaBe
  • 38,030
  • 8
  • 98
  • 117
1

MySql Connector is creating problem. You can change it by going to Control Panel->Programs->Programs and Features and right click MySql Connector Net [version] where [version] is the version number of the installed MySql Connector for .Net and then click change. Then click Next->Change , then click the drop down before web providers and select 'entire feature will be unavailable'. Then click and finish. And You are done.

  • Welcome to Stack Overflow! Please note you are answering a very old and already answered question. Here is a guide on [How to Answer](http://stackoverflow.com/help/how-to-answer). – help-info.de Aug 22 '18 at 15:47
1

You can just comment out the provider as shown below instead of deleting the line. It will also work.

<!-- <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/"/> -->
1

Add the following to web.config

<system.web>
    <siteMap enabled="true">
        <providers>
            <remove name="MySqlSiteMapProvider" />        
        </providers>
    </siteMap>
</system.web>
  • the accepted answer doesn't have the full path. Your answer helped me as I didn't know where to put it. – Souza Jan 02 '23 at 14:17
0

I had this problem

if you use a websitepanel ,go to panel > "websites" > select website and check the "Enable Write Permissions" in home "folder tab"

0

Find the machine.config configuration file in the C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config path and comment the below tag.

<add name="MySqlSiteMapProvider"  type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />