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
+17.1k Golang : When to use init() function?
+4.7k Unix/Linux : How to pipe/save output of a command to file?
+15.5k Golang : Intercept Ctrl-C interrupt or kill signal and determine the signal type
+6k Golang : Missing Subversion command
+11.9k Golang : Find and draw contours with OpenCV example
+5.5k Golang : Configure crontab to poll every two minutes 8am to 6pm Monday to Friday
+13.8k Golang : convert(cast) string to float value
+6k Golang : How to verify input is rune?
+5.8k Unix/Linux : How to open tar.gz file ?
+15.8k Golang : Read a file line by line
+9.2k Android Studio : Indicate progression with ProgressBar example
+9.2k Golang : Apply Histogram Equalization to color images