简体   繁体   English

mysql connect-将我的网站移至本地主机

[英]mysql connect - Moving my website to a local host

I've created a website using a CMS. 我已经使用CMS创建了一个网站。 I've been making updates to the live site and, finally after months of "tsk tsk" from my dev friends have decided to create a local version on my computer to test updates on before making live. 我一直在对实时站点进行更新,最终,经过我的开发者朋友数月的“ tsk tsk”,我决定在我的计算机上创建本地版本,以在进行实时更新之前测试更新。

I copied all of the files and the DB to a folder. 我将所有文件和数据库复制到一个文件夹中。 Then, using XAMPP transferred the files to local host 然后,使用XAMPP将文件传输到本地主机

> http://localhost/mywebsite/

I then created a new database in phpmyadmin called "mywebsite" and imported the downloaded database successfully. 然后,我在phpmyadmin中创建了一个名为“ mywebsite”的新数据库,并成功导入了下载的数据库。

Now, when I navigate to 现在,当我导航到

> http://localhost/mywebsite/

I receive the following message: 我收到以下消息:

An error was detected which prevented the loading of this page. 检测到错误,阻止了该页面的加载。 If this problem persists, please contact the website administrator. 如果此问题仍然存在,请联系网站管理员。 core.error_file_line mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'mywebsitecom.fatcowmysql.com' (1) core.error_file_line mysql_connect()[function.mysql-connect]:未知的MySQL服务器主机'mywebsitecom.fatcowmysql.com'(1)

Presumably I must link the database with the CMS on my computer. 大概我必须将数据库与计算机上的CMS链接起来。 I imagine that this must sound very simple to most people on Stack Overflow but my PHP and DB skills are limited. 我想这对大多数使用Stack Overflow的人来说听起来很简单,但是我的PHP和DB技能却很有限。

Is it immediately apparent to anybody what actions I need to take next to complete local set up? 对任何人来说,立即显而易见的是,接下来我需要采取什么行动才能完成本地设置?

In your mysql_connect call you are giving it mywebsitecom.fatcowmysql.com as a host, locate your code file where you connect to MySQL and change that value to localhost mysql_connect调用中,您将其mywebsitecom.fatcowmysql.commywebsitecom.fatcowmysql.com作为主机,找到您连接到MySQL的代码文件,并将该值更改为localhost

like 喜欢

$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');

Better not to use mysql_* functions anyway :) 最好还是不要使用mysql_*函数:)

You're attempting to connect to a MySQL server at mywebsitecom.fatcowmysql.com, even though said server probably disallows external connections for security reasons. 您正在尝试通过mywebsitecom.fatcowmysql.com连接到MySQL服务器,即使该服务器出于安全原因可能不允许外部连接。 Try connecting to "localhost" instead of "mywebsitecom.fatcowmysql.com". 尝试连接到“ localhost”,而不是“ mywebsitecom.fatcowmysql.com”。 That should work, provided you have MySQL installed on your local system. 只要您在本地系统上安装了MySQL,就可以使用。 Depending on what CMS you're using, you should be able to edit a configuration file somewhere. 根据所使用的CMS,您应该可以在某处编辑配置文件。

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

相关问题 如何将外部服务器上的网站连接到本地主机上运行的 Xaamp 数据库? - How do I connect my website on a external server to my database run off of Xaamp on my local host machine? 将 MySQL 数据库从本地 MAMP 服务器移动到主机的服务器 - Moving MySQL database from local MAMP server to host's server 如何在docker容器中连接我的主机mysql? - How to connect my host mysql in docker container? 将数据库和网站移至同一台机器后,PHP无法连接到mysql - PHP cannot connect to mysql after moving DB & website to the same machine (无法连接到 SMTP 主机)在我的 VPS 上的网站中使用 PHPMailer - (Could not connect to SMTP host) using PHPMailer in my website on my VPS 无法连接到我网站上的 mysql 数据库 - Cannot connect to mysql database on my website 无法将网站连接到我的phpmyadmin MySQL数据库 - Unable to connect Website to my phpmyadmin MySQL database Facebook Connect本地主机 - Facebook Connect Local Host mysql_connect在远程主机连接上返回“无法通过套接字连接到本地MySQL服务器”? - mysql_connect returning “Can't connect to local MySQL server through socket” on remote host connection? 我可以使用 wordpress 文件在我的本地主机中托管 WordPress 网站吗 - can I host a WordPress website in my local host using the wordpress files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM