Koozali.org: home of the SME Server
Legacy Forums => General Discussion (Legacy) => Topic started by: burnside on March 02, 2005, 04:32:46 PM
-
I have recently set up a SME6.x server and have created a database in MySQL. I now wish to be able to connect to the database. Can anyone tell me what the standard connection details would be for connecting using mysql_connect() in PHP. I have the following code:
define ('DB_HOST', 'localhost');
define ('DB_NAME', 'intranet');
define ('DB_USER', 'root');
define ('DB_PASS', 'password');
// Make the connnection and then select the database.
$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASS) OR die ('Could not connect to MySQL: ' . mysql_error() );
mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );
Cheers.
-
Hi burnside,
<?php
// Configuration
$dbhost = "localhost";
$dbuser = "user"; // MySQL Username
$dbpass = "pass"; // MySQL Password
$dbname = "dbname"; // Database Name
//
// Connect to MySQL Database
mysql_connect($d_host,$dbuser,$dbpass);
@mysql_select_db($dbname) or die("Unable to select database");
?>
HTH
-
Thanks for the reply.
It appears that your code will do the same as mine. I take it the default username and password for mysql is user and pass respectively?
Cheers.
-
It appears that your code will do the same as mine. I take it the default username and password for mysql is user and pass respectively?
Cheers.
Hi burnside,
To start off with i don't use root to login to MySQL for MySQL databases that i have created. I create another user and password to access MySQL.
Unless you have changed the root password to MySQL, as i am understand the root password is a random and very long string.
here is a page that might interest you:
http://www.familybrown.org/howtos/mysql-password-howto.html
HTH
-
the default password for mysql on sme is no password.
to test that all is ok i would also log in on the console or via putty, login to mysql with user and pass if pass exist and use the db. that way you rule out any authentication issues.
-
the default password for mysql on sme is no password.
No, Quail_Linux is correct. The default root mysql password on SME is a 76 character string unique to each installation.
-
strange as when I started with mysql on sme i had to change the root password from nothing to what it is at the moment.
anyway
burnsaide how your problem?
-
here is a page that might interest you:
http://www.familybrown.org/howtos/mysql-password-howto.html
HTH
Cheers this solved the problem
-
here is a page that might interest you:
http://www.familybrown.org/howtos/mysql-password-howto.html
HTH
Cheers this solved the problem
Hi burnside,
No problem, glad I could be some help to solve your problem.
-
thanks for that. coupkle of things makes more sense now.