Explore Courses Blog Tutorials Interview Questions
0 votes
in SQL by (6.1k points)

I have installed the MySQL and indeed logged in there as a user.

However, while I try to connect like this:


Neither of it works. Not certain if both are supposed to work, though at least one of them should work.

How can I confirm that the port is indeed 3306? Is there any Linux command to check it anyhow? Plus, is there anymore right way to try it through a URL?

1 Answer

0 votes
by (12.7k points)
edited by

So for determining a listener on a port, do this

netstat -tln

You should see a line that seems like this if MySQL is indeed listening on that port.

tcp        0      0    *                   LISTEN  

Port 3306 is the MySQL's default port.

In order, to connect, you simply have to use any client you need, such as the basic MySQL client.

mysql -h localhost -u user database

Or a URL which is defined by your library code.

Want to become a SQL Expertise? Join the SQL Course and get certified.

Related questions

Browse Categories