I’m building a Next.js application that needs user authentication.
I’m trying to set up a MySQL db in CPanel for that. I am currently mainly interested testing this locally on my laptop.
In CPanel, I used the MySQL wizard, created a user, gave all permissions, then went to the PHPMyAdmin dashboard. Here I imported a .sql file, that adds a “user” table with two users. All this worked well.
My question is how could I connect the db to test this?
import mysql from 'mysql2/promise';
export async function connectToDatabase() {
const connection = await mysql.createConnection({
host: ?, // unsure what to put here
user: username,
password: xxx,
database: name,
});
return connection;
}
I went to PhPMyAdmin to look for the db vars to add to my lib/db.js
but I could not find a value for “host”.