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
+5.7k Cash Flow : 50 days to pay your credit card debt
+18.9k Golang : Check whether a network interface is up on your machine
+12.2k Golang : Display list of countries and ISO codes
+6.6k Golang : Skip or discard items of non-interest when iterating example
+8.3k Golang : How to check if input string is a word?
+4.2k Javascript : How to show different content with noscript?
+5.9k nginx : force all pages to be SSL
+43.1k Golang : Get hardware information such as disk, memory and CPU usage
+37.3k Upload multiple files with Go
+9.7k Golang : Turn string or text file into slice example
+51.2k Golang : Check if item is in slice/array
+11k Google Maps URL parameters configuration