سؤال

I've created a website using a 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.

I copied all of the files and the DB to a folder. Then, using XAMPP transferred the files to local host

> http://localhost/mywebsite/

I then created a new database in phpmyadmin called "mywebsite" and imported the downloaded database successfully.

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)

Presumably I must link the database with the CMS on my computer. I imagine that this must sound very simple to most people on Stack Overflow but my PHP and DB skills are limited.

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

like

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

Better not to use mysql_* functions anyway :)

نصائح أخرى

You're attempting to connect to a MySQL server at mywebsitecom.fatcowmysql.com, even though said server probably disallows external connections for security reasons. Try connecting to "localhost" instead of "mywebsitecom.fatcowmysql.com". That should work, provided you have MySQL installed on your local system. Depending on what CMS you're using, you should be able to edit a configuration file somewhere.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top