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
+29.5k Golang : How to create new XML file ?
+6.5k Golang : Combine slices of complex numbers and operation example
+23.6k Golang : minus time with Time.Add() or Time.AddDate() functions to calculate past date
+7k Golang : How to call function inside template with template.FuncMap
+21.3k Golang : How to force compile or remove object files first before rebuild?
+8.5k Golang : Ackermann function example
+5.2k Golang : Customize scanner.Scanner to treat dash as part of identifier
+7.6k Golang : Set horizontal, vertical scroll bars policies and disable interaction on Qt image
+11.7k Golang : Gorilla web tool kit secure cookie example
+8.3k Golang : Configure Apache and NGINX to access your Go service example
+5.5k Golang : Get S3 or CloudFront object or file information
+7.3k Golang : How to iterate a slice without using for loop?