我想知道如何从Windows 7连接到远程服务器中的MySql数据库。我想从管理面板提供外部连接。如何连接数据库?我有一个PHP编码来插入和检索远程数据库中的值。但在此之前,我需要手动连接到远程数据库?请你帮我解决这个问题。#
<?PHP
$user_name = "fbapp";
$password = " 123";
$database = "fb_db";
$server = "mysql.dfw1.stabletransit.com";
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);
if ($db_found) {
$SQL = "INSERT INTO Sample(Firstname, Lastnamme)
VALUES (35,67)");
$result = mysql_query($SQL);
mysql_close($db_handle);
echo "Records added to the database";
}
else {
echo "Database NOT Found ";
mysql_close($db_handle);
}
?>
答案 0 :(得分:0)
答案 1 :(得分:0)
打开命令提示符
mysql -u user_name -ppassword -h ip-adress
使用运行mysql的机器的ip-address