Its about time I update my local development environment and clean up all the clutter.
Hetzner (my preferred data center) is also rolling out PHP version 7.2 so this forces me to start developing and testing current applications on the same environment.
There are 2 problems to keep in mind when planning these updates:
- Backing up MYSQL databases! Once you delete or uninstall a current XAMP installation, you will lose all your data. The only option is to export each database and while this is doable, it is a tedious and time consuming task.
- Backing up website files. This is easily achieved with a simple copy and paste or better yet, just rename the entire Xamp directory to something like xamp-backup. This way, all the files and folders remain untouched
The biggest concern with updating XAMP or WAMP is losing data especially databases.
Back up first
- Fire up Xamp by right clicking on the shortcut and run as adminstrator, (right click on the icon and click run an administrator).
- Click on the shell button, it should open up a terminal.
- Enter the following command
mysqldump -u root -p --all-databases > all-db-dump.sql
‘root’ is the username and p is the password. The password is usually blank unless youve configured it differently. - Run the command by pushing enter, it may ask for a password, if it does enter the password and hit enter.
- Once the command has run, give it a moment and check your xamp folder for an SQL file called all-db-dump.sql
- To back up the website files, either copy and past the entire htdocs folder or simply rename the xamp foldler to xamp-backup
Following the above instructions will leave you with a back up of all the databases and website files.
You can now uninstall XAMP, download the latest version and install.
Download XAMP here https://www.apachefriends.org/download.html
Once your fresh installation of XAMP is completed, you need to restore your content.
- Copy the content from the previous htdocs folder to the fresh installations htdocs folder.
- Restore the databases by following the instructions below:
Restoring multiple databases
- Open up the command line.
- Cd into the mysql folder at C:\xampp\mysql\bin
- Run the following command
mysql -u root -p < path-to-file/all-db-dump.sql
- Let it run for a while, it may take a few minutes depending on the size of your database backup
I hope this quick reference serves as a guide for others.