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
+12.6k Golang : How to pass map to html template and access the map's elements
+22.2k Golang : Generate MD5 checksum of a file
+12.3k Golang : Query string with space symbol %20 in between
+19.6k Curl usage examples with Golang
+12.6k Android Studio : Use image as AlertDialog title with custom layout example
+3.5k Adding Skype actions such as call and chat into web page examples
+10.2k Golang : Secure file deletion with wipe example
+9.3k Golang : How to transmit update file to client by HTTP request example
+30.5k Golang : Validate email address with regular expression
+6.1k Golang : Validate credit card example
+7.2k Android Studio : Image button and button example
+11k Golang : Forwarding a local port to a remote server example