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
+36.1k Golang : Integer is between a range
+20.3k Golang : Convert seconds to human readable time format example
+7.9k Golang : Reverse a string with unicode
+13.8k Golang : Tutorial on loading GOB and PEM files
+7k Golang : Calculate BMI and risk category
+7.2k Golang : Gorrila mux.Vars() function example
+12.8k Golang : Pass database connection to function called from another package and HTTP Handler
+7.8k Golang : Mapping Iban to Dunging alphabets
+8.7k Python : Fix SyntaxError: Non-ASCII character in file, but no encoding declared
+7.5k Golang : Scanf function weird error in Windows
+6.6k Golang : Calculate diameter, circumference, area, sphere surface and volume
+5.1k Golang : micron to centimeter example