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
+24.2k Golang : How to read integer value from standard input ?
+6k Linux : How to fix Brother HL-1110 printing blank page problem
+8.7k Golang : Ordinal and Ordinalize a given number to the English ordinal numeral
+6.6k Setting $GOPATH environment variable for Unix/Linux and Windows
+7.9k Golang : Find the length of big.Int variable example
+12.4k Golang : Query string with space symbol %20 in between
+5.7k PHP : Shuffle to display different content or advertisement
+9.2k Android Studio : Checkbox for user to select options example
+19.7k Golang : How to read float value from standard input ?
+15.5k Golang : Merge video(OpenCV) and audio(PortAudio) into a mp4 file
+3.8k Golang : Experimental Jawi programming language
+12.3k Golang : Strings comparison