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
+14.2k Golang : Google Drive API upload and rename example
+7k Golang : Muxing with Martini example
+32.4k Golang : Convert []string to []byte examples
+30.3k Golang : Get time.Duration in year, month, week or day
+14.3k Javascript : Prompt confirmation before exit
+16.9k Golang : Gzip file example
+19.4k Golang : Delete item from slice based on index/key position
+4.9k Unix/Linux : How to pipe/save output of a command to file?
+17.7k Golang : Find smallest number in array
+7.3k Golang : Get environment variable
+16.6k Golang : Convert slice to array
+14.8k Golang : How to check if your program is running in a terminal