a two week server n00B here.
I want to edit my website on my local machine. I’m doing this cos I can’t afford programmers at the moment… they have done everything up until now.
I have downloaded the /var/www/ directory to my local machine and I am trying to view the site through localhost on my Mac.
When I do I get the message:
Database connection error (2): Could not connect to MySQL.
Do I need to have the var/lib/mysql/ directory locally for the site to run? Am I going the right way about this?
Additionally I haven’t permission to the mysql directory on the server, the user is “mysql”. I don’t know how to change this as I can’t connect to the ubuntu AWS server through Mindterm… but that’s another story.
In your case the website is made of two components. The Webspace, that’s what you downloaded, and a database. You can’t just copy the files of a database! You have to make a backup ( look for mysqldump on how to do that).
On your Mac you will need a Webserver and a Database-Server. For Endusers like you this is easiest done by using MAMP or XAMPP (i prefer xampp). Both packages provide an full equipped Webserver together with an MySQL Database-Server. You will have to stop the Webserver of OS X to work best with MAMP or XAMPP.
You then have to put your Webspace-Data in the htdocs of your local Webserver and you have to load the Backup of MySQL into the MySQL-Server you installed with MAMP or XAMPP. Both Backups MySQL and Webspace have to be of the same date of backup!
Each of those websites do have one or more config-files containing your URL, User&Password for MySQL etc. you will have to edit those files to work properly on your local server instead of searching for those services in the web.
So it is not an easy way to have a local working copy!