Using portnumber while connecting to mysql

Hello Guys,
Is it necessary to provide the port number in the JDBC url while connecting to mysql?
if its provided then i can use it . but if its not provided and i do hostname -f it only gives the hostname , what about the port number .
i have been doing my practice where i donot use portnumber.
but in certification is port number mandatory?
if yes will they be providing it , if they wont be providing the how to get the portnumber.

thanks in advance.

Login into MYSQL. Enter following command

  1. Show Variables : It will display all the variable list where you can search for port variable. OR
  2. Show Variables Where Variable_name = 'port’ : It will display the information related to port.
    | Variable_name | Value |
    | port | 3306 |
    1 row in set (0.00 sec)

thanks Padma, that helps.

@Avinash_Parida, By default MySQL port number is 3306, and it will not change in certification. While in certification with connection parameters they may provide or not. But it will be default, till now no one complained about port number changed in certification.

okay and i think providing port number or not doesnot make any difference.
does it ?
as i have been using without portnumber.

just was curious from certification point of view.
if it will behave the same way, without giving the port number too. or should i mention it.

While practicing no one gives port number, better to practice with port number and try to practice by typing whole MySQL connection parameter each and every sqoop command so you will not forget in exam.
In certification use port number even though it works without or not.

1 Like

okay got it (y).

1 Like