MySQL 8 or MariaDB with MAMP Pro 6.x

Dec 13, 2022

MAMP Pro 6.x has an old version of MySQL. Version 6.6.4 comes with MySQL 5.7.34. This is a old Version Database-Engine. On many production-Servers there is running MariaDB or MySQL 8. When you need a newer Version on your Development-Machine, then you must set the Port of the integrated MAMP Pro-MySQL to 3307.

Install

To Install MariaDB or MySQL 8 on MacOS you can use Homebrew (https://brew.sh/). And then

brew install mariadb

or

brew install mysql

and follow the installation instructions:
MariaDB: https://mariadb.com/de/resources/blog/installing-mariadb-10-1-16-on-mac-os-x-with-homebrew/
MySQL: https://flaviocopes.com/mysql-how-to-install/

You MUST install MySQL 8 or MariaDB with Socket-Authorization.

MariaDB and MySQL 8 Port

After installation MySQL 8 or MariaDB listen on Port 3306.

Connection with Laravel:

DB_HOST=127.0.0.1;unix_socket=/tmp/mysql.sock

Connection with Standard-PHP:

$mysqli = new mysqli("localhost", "user", "password", "database", 3306, "/tmp/mysql.sock");

If you want to use the built-in MySQL 5.x, then you have to specify the port with the database connection in the future.

In Standard PHP:

$mysqli = new mysqli("127.0.0.1", "user", "password", "database", 3307);

With Laravel:

DB_HOST=127.0.0.1
DB_PORT=3307

Have fun with the new possibilities