0

I am using MySQL to create database using ubuntu. I downloaded and installed MySQL in terminal and I create database and insert data on it. Now, I have to select the ip_adress and the port number where MySQL is runing. But, I don't understand how to get these informations.

Is there anyone who can help me ?

User94
  • 39
  • 1
  • 10
  • MySQL default port for TCP/IP connections is 3306, and if you installed this on the same machine, then the server name is usually just `localhost` or the local IP address, `127.0.0.1` – CBroe Sep 19 '17 at 08:33
  • Thank you for your reply. I get an error when using these informations: :1: error: ';' expected but double literal found. 127.0.0.1:3306 – User94 Sep 19 '17 at 08:51
  • _Where_ are you trying to put this information? Config file of a certain system/software? What does the documentation of that says about in what format it expects this? – CBroe Sep 19 '17 at 08:54
  • I am using spark shell to load data from MySQL to HDFS. So, I have to put the ip adress and the port number of MySQL before loading data to HDFS. – User94 Sep 19 '17 at 09:16

2 Answers2

0

the default port of mysql is 3306 and the ip you get from you pc or just use LOCALHOST(127.0.0.0.1)

colapiombo
  • 179
  • 1
  • 3
  • 13
  • Thank you for your help. When using 127.0.0.1:3306, I get this error: :1: error: ';' expected but double literal found. 127.0.0.1:3306 – User94 Sep 19 '17 at 08:49
  • where you are putting this ip? – colapiombo Sep 19 '17 at 08:56
  • I am using spark shell to load data from MySQL to HDFS. So, I have to put the ip adress and the port number of MySQL before loading data to HDFS. – User94 Sep 19 '17 at 09:17
0
  • You can use ifconfig command to get the ip address of the machine
  • As far as port is concerned, the default port for MySQL is 3306. However, you can change this via my.cnf file (if you have't changed it then it will be 3306). Here's how to find my.cnf file location.
Darshan Mehta
  • 30,102
  • 11
  • 68
  • 102
  • Thank you for your reply. I used 'ifconfig' to get ip adress and then I put the default port for MySQL 3306, but it shows this error: ':1: error: ';' expected but double literal found. 127.0.0.1:3306' – User94 Sep 19 '17 at 08:47
  • I am using spark to load data from MySQL into Spark. So, I start the Spark shell using this command: 'spark-shell', then I have to put the ip address and port number. '127.0.0.1:3306' but it shows this error: scala> 127.0.0.1:3306 :1: error: ';' expected but double literal found. 127.0.0.1:3306 ^ – User94 Sep 19 '17 at 09:47