使用mysql和PHP从本地计算机连接到远程数据库 [英] Connecting to a remote database from a localhost computer using mysql and PHP

查看:417
本文介绍了使用mysql和PHP从本地计算机连接到远程数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这里是情况。
我在远程服务器上有一个数据库,给出个别学生的测验和分数...

So here is the situation. I have a database on a remote server that gives out quizzes and scores for individual students...

我还有一个本地数据库,其中包含学生姓名

I also have a local database which contains the students names and their respective groups.

我想要做的是显示每个组的学生列表,然后从远程数据库显示他们的分数结果。这是可能的

What I want to do is to display the list of students per group then show the results of their scores from the remote database.. Is this possible??

当前使用XAMMP从我的本地计算机运行脚本的Im如
mysql_connect(REMOTE SERVER ADDRESS,USERNAME,PASSWORD) or die(Could not connect to MySQL server!);

Im currently running the script from my local computer using XAMMP like so mysql_connect("REMOTE SERVER ADDRESS","USERNAME", "PASSWORD") or die("Could not connect to MySQL server!");

但是我得到的是无法连接到MySql Server ..

But all I get is Could not connect to MySql Server..

推荐答案

GRANT ALL ON database.* TO user@ipaddress IDENTIFIED BY 'password';

您应该使用以下命令重新加载授予表:

You should force a reload of the grant tables using:

FLUSH PRIVILEGES;

这篇关于使用mysql和PHP从本地计算机连接到远程数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆