Install and configure MariaDB locally on macOS using Homebrew, then connect and create sample ecommerce tables.
Run brew install mariadb
to download and compile the latest stable MariaDB package. Homebrew handles dependencies automatically, ensuring a clean installation.
Launch MariaDB immediately with brew services start mariadb
. This command also registers MariaDB as a launch agent so it boots automatically after each macOS restart.
Harden the server by running mysql_secure_installation
. The wizard lets you set a strong root password, remove anonymous users, disallow remote root logins, and drop the test database.
Use mysql -u root -p
, then enter the password you just set. You’ll land in the MariaDB shell ready to run SQL.
Execute: CREATE DATABASE ecommerce;
followed by CREATE USER 'shop_admin'@'localhost' IDENTIFIED BY 'StrongPass1!';
and GRANT ALL PRIVILEGES ON ecommerce.* TO 'shop_admin'@'localhost';
.
Switch to the new database with USE ecommerce;
and paste the table definitions in the next section. Having realistic data structures accelerates local testing.
Enable slow-query logging (SET GLOBAL slow_query_log = 1;
) and adjust innodb_buffer_pool_size
to 50-70% of system RAM for better performance. Always back up /usr/local/var/mysql
with Time Machine or a scheduled mysqldump
.
--build-from-source
compiles fully on your machine, while --with-openssl
links against OpenSSL for TLS 1.3 support. Most users can omit them; the default bottle works fine.
Main configuration lives in /usr/local/etc/my.cnf
. Override server settings in [mysqld]
, then restart the service to apply changes.
No. Homebrew distributes native ARM64 bottles for MariaDB, so installation works without Rosetta translation.
Run brew upgrade mariadb
, then execute mysql_upgrade
to update system tables.
Technically yes by changing port numbers, but avoid it. Running both can cause socket conflicts and double your RAM usage.