-2

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?

mysql -u your_username -p -h your_host -P your_port -D your_database

I am unsure how to find these values.

4
  • Hi, add localhost to the host value, as described here sidorares.github.io/node-mysql2/docs/examples/connections/… Commented Jul 9 at 14:19
  • Hi @MicheleDeFalco -- maybe I didn't word myself clear enough but I want to use the MySQL db that I created on CPanel on my laptop. For simple testing purposes, how can I find the values for: mysql -u your_username -p -h your_host -P your_port -D your_database Commented Jul 9 at 14:45
  • cPanel provides the most reliable and intuitive server and site management platform.. So your database, which is defined under cPanel can be remote, and need not be accessible locally (which is needed when wanting to use mysql -u ..... ), unless you also have a VPN to the site where cPanel is running.
    – Luuk
    Commented Jul 9 at 14:50
  • 1) you need to configure your mysql to be accessible remotely and configure firewalls and any any other securoty tools to allow remote mysql access. In this case you need to know the host name of your computer that runs mysql to connect to. Or 2) you need to create VPN or ssh tunnel to create a secure channel to your remote server and login that way. Probably a lot more secure than the 1st option. None of this is a programming problem, so this question is off topic here on SO.
    – Shadow
    Commented Jul 10 at 6:23

0

Browse other questions tagged or ask your own question.