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
+18.9k Golang : Get RGBA values of each image pixel
+8.3k Python : Fix SyntaxError: Non-ASCII character in file, but no encoding declared
+10.8k How to test Facebook App on localhost ?
+5.3k Unix/Linux : How to find out the hard disk size?
+11.5k Golang : Setup API server or gateway with Caddy and http.ListenAndServe() function example
+6.1k Golang : Break string into a slice of characters example
+8.9k Golang : How to check if a string with spaces in between is numeric?
+3k Golang : Fix go-cron set time not working issue
+5.5k Linux/Unix/PHP : Restart PHP-FPM
+7.9k Android Studio : Rating bar example
+17.6k Golang : Get all upper case or lower case characters from string example
+8.6k Golang : Find network service name from given port and protocol