启用远程连接到Debian上的MySQL数据库

问题描述:

我已经在Debian Lenny 5.0上安装了MySQL数据库,并且我试图使用PHP远程连接到该数据库。启用远程连接到Debian上的MySQL数据库

这是我登录方式:

$con = mysql_pconnect("MY_IP_ADDRESS","root","MY_PASSWORD"); 
if (!$con) 
die('Could not connect: ' . mysql_error()); 

,这是我得到的错误:

Could not connect: Access denied for user 'root'@'li273-10.members.linode.com' 
(using password: YES) 

哪个林不知道为什么我的Linode用户在那里出现。

为了让我用这个教程的远程连接:http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

另一件事我注意到,在我上的MySQL的phpmyadmin边我有这样的:

Server: localhost via TCP/IP 
Server version: 5.0.51a-24+lenny5 
Protocol version: 10 
User: [email protected] 

我想这是本地主机有成为我的服务器的IP地址?

我做错了什么?

从教程没有工作,很少有事情:

保存所有规则:service iptables save不起作用。我得到这个错误:

-bash: service: command not found 

最后,当我做的mysql -u WebAdmin的-h MY_IP -p我得到这个:enter image description here

+0

[启用远程MySQL连接]的可能重复(http://*.com/questions/8380797/enable-remote-mysql-connection) – user 2014-03-10 03:33:49

你需要创建一个用户/远程用户的权限为好。可能root用户的权限只能被定义为root @ localhost。

您需要定义用户权限,如user @%或[email protected]

http://dev.mysql.com/doc/refman/5.0/en/create-user.html

你可能不希望给超级用户帐户(root在这种情况下)的远程访问。

您的主机名出现在验证行中,因为您实际以用户@主机名连接到数据库。

+0

这会创建用户'用户'与密码'密码',并给予完整的权限?授予所有特权*。*到'user'@'%'IDENTIFIED BY'password'WITH GRANT OPTION; – jQuerybeast 2012-03-09 21:37:26

+0

我爱你,先生。 – jQuerybeast 2012-03-09 21:56:38