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
+23.4k Golang : Record voice(audio) from microphone to .WAV file
+8.4k Golang : Fix - does not implement sort.Interface (missing Len method)
+4.1k Golang : How to solve "too many .rsrc sections" error?
+14.6k Golang : delete and modify XML file content
+7.5k Golang : ffmpeg with os/exec.Command() returns non-zero status
+6.1k Golang : Error reading timestamp with GORM or SQL driver
+24k Golang : missing Mercurial command
+4.2k Unix/Linux : How to test user agents blocked successfully ?
+6.6k Golang : How to get username from email address
+16.1k Golang : Read binary file into memory
+8.2k Golang : Characters limiter example
+7k Golang : Write multiple lines or divide string into multiple lines