From the course: Master Next.js by Building Scalable Apps with Routing, Databases, and Performance

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Link the MySQL database to admin application

Link the MySQL database to admin application

Now, let me open the admin directory and navigate to the prisma.schema file. Here I will change the provider from SQLite to MySQL in the data source. Next I will change the database URL in the env file. So let me open the .env file and replace the URL with mysql colon slash username colon password at host and the database name. As you already know, we have created the privileged user for our database. So I will use the username and password of that user here. Now let me add the host and for that I will navigate to the cpanel. Copy the shared IP address. Going back to .env file and pasting it in place of host. Here I will also add the port number. So I will navigate to the phpMyAdmin tab. Here you can see server colon localhost colon 3306, where this 3306 will be the port. So let me go back to the dotenv file and add the port 3306 after the IP address. And finally, I will add the mystoredb in place of database name. Let's save the file and open the terminal. I'll regenerate the Prisma…

Contents