.net 连接mysql的字符串_.net c#在MySql连接字符串中使用密码?

If I want to make a C# login form, with a Mysql databse which provides the userdata, in c#, i would say it's unsafe to write the database password, database username and database name in the connection string. Am i right? And is there another way like a webserver which will connect to the database and check if userdata is right?

Talk1:

Well if you use another service to do the login, wont that have the access credentials somewhere in the connection string?

Talk3:

that reference Link is for msft sql-server. And Tom can you please improve your question because right now it is quite unclear and is not helping much to keep it around. In other words if you are using Apache or something then .NET is not too relevant in some of the answers below

Solutions1

You should store such things in a configuration file. .NET has the option to use encryption in web.config / app.config.

Solutions2

Either way you will have to provide those credentials. You can pass them in connection string in your code (OR) can have those maintained in web.config or app.config file in which case you can actually encrypt the password and have the encrypted value mentioned in connection string.


版权声明:本文为weixin_42139357原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。