我试图简单地将我正在使用的SQL版本打印到网页上,这是我的老师提供的代码,我已经放入我的服务器和数据库中,我不知道如何找到我的数据库用户名和如果它有密码。
// add here your connection details
String connectionString = "SERVER=127.0.0.1; DATABASE=dblogin;"
+ "UID=YOUR_DB_USERNAME; PASSWORD='';";
// create and open a connection to the database
MySqlConnection connection = new MySqlConnection(connectionString);
connection.Open();
// print the MySQL version in a console
ReturnError.Text = ("MySQL version: " + connection.ServerVersion);
// this line will prevent the console from closing immediately
// to close the console just press any key
最佳答案
在安装mysql期间,它通常会要求输入root
用户名和密码,尝试使用空密码root
,如果它不起作用 - http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
关于c# - MySQL:查找数据库用户名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19392204/