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
+9.6k Golang : Populate slice with sequential integers example
+12.9k Swift : Convert (cast) Int to String ?
+17.7k How to enable MariaDB/MySQL logs ?
+13.9k Golang : How to check if a file is hidden?
+7.4k Golang : Handling Yes No Quit query input
+6.6k Golang : Reverse by word
+5.3k Swift : Convert string array to array example
+13.3k Golang : Read from buffered reader until specific number of bytes
+9.1k Golang : does not implement flag.Value (missing Set method)
+28.7k Golang : Detect (OS) Operating System
+17.2k Google Chrome : Your connection to website is encrypted with obsolete cryptography
+7.3k Golang : Scanf function weird error in Windows