2009-12-31 35 views
1

海家伙,
这个连接字符串有什么问题?

我用下面的连接字符串

<add name="connectionString" connectionString="server=localhost;user id=root; password=; database=lms; pooling=false;" providerName="MySql.Data.MySqlClient"/> 

它给我的错误There is no 'lms'@'%' registered

我的数据库服务器为localhost,并且用户帐户没有密码..

+0

user id = root。你确定用户标识之间允许有空格吗,不是用户标识吗? – Sarfraz 2009-12-31 08:56:35

+0

雅我相信有空间。 – bala3569 2009-12-31 08:57:34

+0

你用什么驱动程序连接到MySQL - OLE或ODBC? 'user id ='是OLE语法; 'uid ='或'USER ='是ODBC:http://www.webcheatsheet.com/ASP/mysql_connection_strings.php – 2009-12-31 08:58:39

回答

0

下面是一个MySQL的工作连接字符串:

server=localhost;user id=root;password=xxx;database=xxx;pooling=false 

你能在命令行连接(使用 “MySQL的”)?

mysql是否被绑定到除localhost之外的其他IP(在my.ini中)?

如果你没有密码,你有没有试过离开password=

如果这不起作用,您可能需要添加密码....

0

F0r MySQL中,应该是这样的:

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword 
+0

它没有为我工作 – bala3569 2009-12-31 09:05:22

+0

同样的错误没有'lms'@'%'注册 – bala3569 2009-12-31 09:07:40

0

它不应该是这样的:

<add name="ConnString" connectionString="Database=lmz;Data Source=localhost;User Id=root;Password=;CHARSET=utf8;" providerName="MySql.Data.MySqlClient"/> 

还要检查用户是否有权限访问数据库。