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
+7.7k Golang : Gonum standard normal random numbers example
+25.1k Golang : Calculate future date with time.Add() function
+6k Golang : A simple forex opportunities scanner
+4.8k Unix/Linux : Get reboot history or check when was the last reboot date
+6.4k Golang : How to convert strange string to JSON with json.MarshalIndent
+7.9k Golang : Find the length of big.Int variable example
+11.7k Golang : http.Get example
+9.2k Golang : cannot assign type int to value (type uint8) in range error
+13.7k nginx: [emerg] unknown directive "ssl"
+5.5k Android Studio : Hello World example
+17.9k Golang : Fix cannot download, $GOPATH not set error