Golang : What is the default port number for connecting to MySQL/MariaDB database ?
Problem :
How to determine which port number when trying to connect to a database with https://github.com/go-sql-driver/mysql and configuring the data source name.
conn, err := sql.Open("mysql", "db_username:db_password@protocol(address:port_num)/database_name")
Need to find out the port_num portion.
Solution :
The default port number to connect to MySQL or MariaDB is 3306
. Got this from looking at the PHPMyAdmin's configuration file.
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+21k Golang : Repeat a character by multiple of x factor
+8.6k Golang : How to check if a website is served via HTTPS
+6k Linux : How to fix Brother HL-1110 printing blank page problem
+21.5k Golang : Get ASCII code from a key press(cross-platform) example
+4.6k Unix/Linux : How to find out the hard disk size?
+4.5k Swift : Convert string array to array example
+11.2k Golang : Listen and Serve on sub domain example
+10.5k Golang : Find and draw contours with OpenCV example
+4.5k Golang : fmt.Println prints out empty data from struct
+3.2k Javascript : Empty an array example
+19.3k PHP : Convert(cast) int to double/float