Blog

Set up a local server on Mac (like Lamp, Xammp, Wamp etc)
Updated: 22 November 2021

You will need Apache, Mysql and PHP.

PHP and Apache are already preinstalled on your Mac so open terminal (you can find it in launchpad) and run:
sudo apachectl start

Install Brew (Package Manager for Mac).
go to https://brew.sh

Install PHP. Open terminal and type
brew install php

Install MySQL
brew install mysql

and then start mysql
brew services restart mysql
or mysql.server start


If you get this error (I got this on Laravel + mysql 8)
The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = rest and table_name = migrations and table_type = 'BASE TABLE')

mysql -uroot
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';
exit

Default Auth Data
user is root with no password, so just leave the password field blank)

Cheatsheet
sudo apachectl start
sudo apachectl restart
sudo apachectl stop

mysql.server start
mysql.server restart
mysql.server stop

import SQL
source backup.sql