Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql server port number

I've just made a database on mysql on my server. I want to connect to this via my website using php. This is the contents of my connections file:

$dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'password';  $conn = mysql_connect($dbhost, $dbuser, $dbpass)     or die('Error connecting to mysql');  $dbname = 'epub'; mysql_select_db($dbname); 

I know what the username/passwords are, and I know the IP address of the server. What I'm just wondering is how do I know which port to use?

like image 449
109221793 Avatar asked Sep 17 '10 14:09

109221793


People also ask

How do I find MySQL port number?

Another way to find out the port which MySQL Server is using on Windows is , Go to my. ini file that is MySQL configuration file and you can check the port. To find the my. ini file for MySQL Server, you can go to services and then go to properties.


1 Answers

If your MySQL server runs on default settings, you don't need to specify that.

Default MySQL port is 3306.

[updated to show mysql_error() usage]

$conn = mysql_connect($dbhost, $dbuser, $dbpass)     or die('Error connecting to mysql: '.mysql_error()); 
like image 118
Mchl Avatar answered Oct 12 '22 21:10

Mchl