先谢谢这么快回复,我按照你说的,通过phpMyAdmin另外建了一个用户,权限和root一样,All Privileges,就是主机不一样,这个时候通过Dreamweaver连接数据库连不上,我有点不明白的是,这个时候的testing server应该设成什么 localhost, 还是网络服务器主机, 另外在指定MySQL Server时设成什么?下面是我指定的,没有成功, Connection name;connmysql_test2 MySQL server:网络服务器的主机 然后是Username和Password,就是我上面说的新建的那个用户,但连接后出现 Host 主机名 is not allowed to connect to this MySQL Server?这是什么原因呢?请指教,还有一个问题,网络服务器上我倒是知道有MySQL环境,但是MySQL是否打开我不清楚,需要这么做吗?(比如在localhost时,EasyPHP上就把MySQL打开了),如果需要,只有明天去问一下网管了,再次谢谢,以上问题还请帮忙。
$hostname_connmysql_test2 = "localhost"; $database_connmysql_test2 = "authormember"; $username_connmysql_test2 = "root"; $password_connmysql_test2 = "mypassword";分两种情况说: 1、数据库还在你的机器A上研究室的网络服务器B上面的程序就要修改 /*上A访问数据库*/ $hostname_connmysql_test2 = "ip of A or name of A";A上的mysql就要允许B以用户$username_connmysql_test2 登陆2、数据库放到网络服务器B上 程序不用修改 $hostname_connmysql_test2 = "localhost";导出A上的数据库,导入到B中的mysql中,再让B的管理员提供B的mysql用户名密码 /*上B访问数据库*/ $username_connmysql_test2 = "root"; $password_connmysql_test2 = "mypassword"; 对应修改
我采用你说的第一种办法, $hostname_connmysql_test2 = "IP address of my computer"; $username_connmysql_test2 = "root";(任意主机用户) $password_connmysql_test2 = "mypassword";但是运行了后,出现下面这个warning Warning: mysql_pconnect(): Can't connect to MySQL server on 'ip' (4) in /export/home/www/procceding2007/php_test2/Connections/connmysql_test2.php on line 9Fatal error: Can't connect to MySQL server on 'ip' (4) in /export/home/www/procceding2007/php_test2/Connections/connmysql_test2.php on line 9不过,我按照你给的思路现在干脆访问数据库的网页从服务器移到我机器上,建立了一个链接,这样也将就用,我想道理应该是一样的,我公布了建在自己机器的apache,别人可以通过IP访问我的网页,就应该可以访问放在我机器上的数据库。现在没时间了,先将就对付一下,慢慢自己再来调试。真的很感谢fredyj(悄悄问一下,问题暂时解决了怎么给你加分啊,我不会,20分要兑现呢)
Connection name;connmysql_test2
MySQL server:网络服务器的主机
然后是Username和Password,就是我上面说的新建的那个用户,但连接后出现
Host 主机名 is not allowed to connect to this MySQL Server?这是什么原因呢?请指教,还有一个问题,网络服务器上我倒是知道有MySQL环境,但是MySQL是否打开我不清楚,需要这么做吗?(比如在localhost时,EasyPHP上就把MySQL打开了),如果需要,只有明天去问一下网管了,再次谢谢,以上问题还请帮忙。
改为
主机: 任意主机应该就可以从任意主机登陆mysql了,还不行的话,真需要找网管看看了。
$database_connmysql_test2 = "authormember";
$username_connmysql_test2 = "root";
$password_connmysql_test2 = "mypassword";分两种情况说:
1、数据库还在你的机器A上研究室的网络服务器B上面的程序就要修改
/*上A访问数据库*/
$hostname_connmysql_test2 = "ip of A or name of A";A上的mysql就要允许B以用户$username_connmysql_test2 登陆2、数据库放到网络服务器B上
程序不用修改
$hostname_connmysql_test2 = "localhost";导出A上的数据库,导入到B中的mysql中,再让B的管理员提供B的mysql用户名密码
/*上B访问数据库*/
$username_connmysql_test2 = "root";
$password_connmysql_test2 = "mypassword";
对应修改
$hostname_connmysql_test2 = "IP address of my computer";
$username_connmysql_test2 = "root";(任意主机用户)
$password_connmysql_test2 = "mypassword";但是运行了后,出现下面这个warning
Warning: mysql_pconnect(): Can't connect to MySQL server on 'ip' (4) in /export/home/www/procceding2007/php_test2/Connections/connmysql_test2.php on line 9Fatal error: Can't connect to MySQL server on 'ip' (4) in /export/home/www/procceding2007/php_test2/Connections/connmysql_test2.php on line 9不过,我按照你给的思路现在干脆访问数据库的网页从服务器移到我机器上,建立了一个链接,这样也将就用,我想道理应该是一样的,我公布了建在自己机器的apache,别人可以通过IP访问我的网页,就应该可以访问放在我机器上的数据库。现在没时间了,先将就对付一下,慢慢自己再来调试。真的很感谢fredyj(悄悄问一下,问题暂时解决了怎么给你加分啊,我不会,20分要兑现呢)
EasyPHP1.8
没用过 ,不知道是不是里面mysql做了设置的限制,别着急,慢慢来吧。嘿嘿,不用客气,拿了分就跑………………呼呦呼呦~~