简体   繁体   中英

How to write server name in connection string at web.config file

I need to know that how to write server name in connection string at webconfig where as Database is mysql and and it is on localhost:8080 and using asp.net web.config file for writing connection string

<add key="mySqlConn" value="DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost:8080;     PORT=3306;DATABASE=dbname; UID=root; PASSWORD=; OPTION=3"/>

I had put this snippet in web.config file but got this error

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

The things i need to know plz check

  1. Servername as locally it runs on localhost:8080 due to skype.
  2. Driver name.(What connector we have to install either phpmyadmin one or previous one as my phpmyadmin is upgraded)

You're not specifying the port properly for localhost. Is your port 8080 or 3306? Set your value parameter to this:

Driver={MySQL ODBC 3.51 Driver};Server=localhost;Port=YOURPORTNUMBER;
Database=dbname;User=root;Password=;Option=3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM