0

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?

Doug Fir
  • 19,971
  • 47
  • 169
  • 299
  • 1
    You have a couple of options here. The final goal will be to find the config file that the cms uses and change the mysql login details in that file so it connects to your local version of the database. Hove a look for a file called config.php or let us know what CMS its using if you know and we might be able to point to the right file. However for now, you could create a simple php page with a mysql connection inside it and test to see if that connects ok. It might sound crazy but its quite simple to do:http://www.w3schools.com/php/php_mysql_connect.asp – azzy81 Apr 10 '13 at 15:53
  • thanks for the information that has kind of worked - I have a local version running though all of the CSS is missing. I think the original question has been answered though so am going to post a separate question. Thanks again – Doug Fir Apr 10 '13 at 16:13

2 Answers2

2

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 :)

Hanky Panky
  • 46,730
  • 8
  • 72
  • 95
1

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.

Wayne Whitty
  • 19,513
  • 7
  • 44
  • 66