简体   繁体   English

将我的sql数据库localhost移到实时服务器

[英]moving my sql database localhost to live server

i want to move my sql database and i have exported and imported mysql.sql file from localhost to live server and now im not getting the files and content from that database. 我想移动我的sql数据库,并且已经将mysql.sql文件从localhost导出并导入到实时服务器,现在我没有从该数据库中获取文件和内容。 what i do ? 我所做的 ? i did make sure connection to database if fine and successful 我确实确保如果成功可以连接到数据库

here's my page http://shooop23.byethost7.com 这是我的页面http://shooop23.byethost7.com

<?php

$db = mysqli_connect('','','','');
if(mysqli_connect_errno()){
    echo'Database Connection Failed with following errors: '. mysqli_connect_errno();
    die();
}


?>

Once you have successfully established a connection to MySQL, you need to perform a query specifying what you want to retrieve and then subsequently retrieve it. 成功建立与MySQL的连接后,需要执行查询以指定要检索的内容,然后再检索它。

The following example uses mysqli_fetch_row 以下示例使用mysqli_fetch_row

You should explore the documentation to learn the basics. 您应该浏览文档以学习基础知识。

$db = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db');

if(mysqli_connect_errno()){
    echo'Database connection failed with the following error: '.mysqli_connect_errno();
    exit;
}

if ($result = mysqli_query($db, "SELECT MyCol1,MyCol2 FROM MyTable")) {
    while ($row = mysqli_fetch_row($result)) {
        echo"{$row[0]} - {$row[1]}<br>");
    }
    mysqli_free_result($result);
}

mysqli_close($db);
$db = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db');
$sql="SELECT * FROM login";

here i connected and stored my database and set a sql command (which is now a string) into these two veriables. 在这里,我连接并存储了数据库,并在这两个Veriable中设置了一个sql命令(现在是一个字符串)。

if(mysqli_connect_errno()){
    echo'Database connection failed with the following error: '.mysqli_connect_errno();
exit;
}

this is to check if the database is correctly connected, if not then it will show some errors. 这是为了检查数据库是否正确连接,否则将显示一些错误。

$result = mysqli_query($db,$sql);

here i put the database and the sql command to run my query. 在这里,我将数据库和sql命令用于运行查询。

while($row = mysqli_fetch_array($result)){
      echo $row['username'];
}

here finally outputting the usernames(username is one of the column in my table in this case) which matched with that query i will suggest This Sql site to get a better understanding on sql queries and try to improve the secuirty because this is the basic point where hackers try to inject their attact most offenly. 在这里,最后输出与该查询匹配的用户名(在这种情况下,用户名是我的表中的列之一),我将建议此Sql网站更好地理解sql查询并尝试提高安全性,因为这是基本要点黑客试图最讨厌地攻击他们的地方。 Note : If your table's in the database are empty then it will not able to fetch anything 注意:如果数据库中的表为空,则它将无法获取任何内容

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将我的Codeigniter站点从实时服务器移动到本地主机时出现问题 - Problem in moving my Codeigniter site from live server to localhost 使用PHP将数据库从实时服务器导出到本地主机? - Export database from my live server to my localhost with php? 使用GoDaddy cPanel将Wordpress网站从本地主机移动到实时服务器 - Moving wordpress site from localhost to live server using GoDaddy cPanel 移动Joomla后出现错误! 网站从本地主机到实时服务器 - Errors after moving Joomla! website to live server from localhost 将站点从本地主机移动到实时服务器时出现 Wordpress 错误 - Wordpress error while moving site from localhost to live server 将 WordPress 从 Live 迁移到本地主机 - Moving WordPress from Live to Localhost Mac上的SQL Server数据库(用localhost替代远程) - SQL server database on mac (replacing remote with localhost) 将网站从Windows本地主机移到Linux Live服务器:文件名和路径问题 - Moving website from Windows localhost to Linux live server: issues with filenames and paths 网站未选择样式。从活动服务器移至localhost后,Joomla网站变形 - Site not picking styles.Joomla Site deformed after moving to localhost from live server Codeigniter对于本地主机是可以的,但是在实时服务器上它显示“ database.php不存在”,如果使用linux cPanel,如何定位数据库? - Codeigniter is ok with localhost, but on a live server it says “database.php does not exist”, how can I locate my database if I use linux cPanel?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM