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
+15.5k Golang : How to login and logout with JWT example
+18.7k Golang : Read input from console line
+10.4k Golang : How to delete element(data) from map ?
+10.9k Golang : Roll the dice example
+5.4k Golang : Frobnicate or tweaking a string example
+6.1k Golang : How to get capacity of a slice or array?
+54.9k Golang : Unmarshal JSON from http response
+18.2k Golang : Get download file size
+29.1k Golang : Record voice(audio) from microphone to .WAV file
+6.4k Golang : How to validate ISBN?
+7k Golang : How to iterate a slice without using for loop?
+6.3k Grep : How to grep for strings inside binary data