Skip to content

How do I connect a MySQL database?

Updated 20 August 2026·1 views

Connecting MySQL

Requires MySQL 8.0 or higher.

Create a database and user

\\\sql CREATE DATABASE underpeaks CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'underpeaks'@'%' IDENTIFIED BY 'your-password'; GRANT ALL PRIVILEGES ON underpeaks.* TO 'underpeaks'@'%'; FLUSH PRIVILEGES; \\\

Environment variables

\\\env NEXT_PUBLIC_DB_TYPE=mysql NEXT_DB_MYSQL_HOST=localhost NEXT_DB_MYSQL_PORT=3306 NEXT_DB_MYSQL_USER=underpeaks NEXT_DB_MYSQL_PASSWORD=your-password NEXT_DB_MYSQL_DATABASE=underpeaks \\\ Underpeaks requires utf8mb4 for full Unicode support including emoji. If using a managed MySQL service (PlanetScale, AWS RDS), you may need to disable foreign key checks if required by the provider.

Was this article helpful?