Page 1 of 2
mysqli_real_connect: warning
Posted: Wed Dec 08, 2004 6:19 am
by dukey.
I'm using php5 and am receiving the following error;
Warning: mysqli_real_connect() [function.mysqli-real-connect]: Unknown MySQL Server Host 'localhost:3306' (11001) in c:\server\apachegroup\Apache\htdocs\cmsmadesimple\adodb\drivers\adodb-mysqli.inc.php on line 83
Connection failed
.db has been created and the user has set privileges for named database. I've convirted the authentication back to OLD_Password format aswell. Can someone please provide some assistance.
Regards.
mysqli_real_connect: warning
Posted: Wed Dec 08, 2004 6:27 am
by dukey.
problem solved.
Re: mysqli_real_connect: warning
Posted: Sun Mar 06, 2005 8:13 am
by Frog
I get this same error but have no idea what is wrong... wouldn't it have been useful if the person had explained how they had fixed it.... oh well guess I'm heading for a different cms
Re: mysqli_real_connect: warning
Posted: Mon Mar 14, 2005 3:33 pm
by Frank
dukey. wrote:
problem solved.
HOW???
Re: mysqli_real_connect: warning
Posted: Mon Mar 14, 2005 8:08 pm
by SirChiba
I get the same error message. It would be greatly appreciated if anyone could help. What did you do, Dukey?
I am using:
Win32
Apache 2.0.53
PHP 5.0.3
MySQL 4.1
CMSMadeSimple 0.9.2
Re: mysqli_real_connect: warning
Posted: Tue Mar 15, 2005 2:13 am
by jptechnical
that error usually indicates that the mysql server could not be found.
So, check that the mysql service is running and make sure it has the right port number. If you are running this on a windows box from the command prompt type 'netstat -a' and look for the port number 3306 (host:port#) under the local address column. If you find it then your mysql server is running, if you have a 3307 it is possible the mysql service is running twice and has taken the next available port number 3307.
At least see if it is running and go from there.
Re: mysqli_real_connect: warning
Posted: Tue Mar 15, 2005 7:32 am
by SirChiba
Hi, jptechnical,
thanks for answering! Sadly, I still get the same error. The mySQL server is running fine on 3306. Permissions are set for cms_user and the mySQL and Apache services have been restarted numerous times.
Note: I had to add the php_mysqli extension to php.ini to get past step 3 in the installation process.
S
Re: mysqli_real_connect: warning
Posted: Tue Mar 15, 2005 5:36 pm
by jptechnical
If memory serves me, during the installation you are given a drop down choice of your mysql version. Have you tried changing that? I think I had a problem with that on a windows test box and I just set it to use the older mysql version and it worked.
Otherwise, make abesolutely sure that the files in the adodb dir are good. Try re-uploading them or even download the latest version from the web. Only copy over the files that you already have in your directory.
Re: mysqli_real_connect: warning
Posted: Tue Mar 15, 2005 7:05 pm
by SirChiba
IT WORKS!! I set the drop down menu to "MySQL 3.x / 4.0" instead of setting it to the version I am actually using, namely 4.1. A bit quirky, but golly it works!
Thanks a heap, jptechnical!
S
Re: mysqli_real_connect: warning
Posted: Tue Mar 15, 2005 7:17 pm
by jptechnical
Right on.
Perhaps someone could explain the real differences between the 2 choices. I think I have always chosed the older version perhaps as being more compatible?
Re: mysqli_real_connect: warning
Posted: Tue Mar 15, 2005 7:43 pm
by Ted
Basically, I have both options there because there is a flux right now between versions. Generally, mysql 4.1 requires the mysqli library to handle it's new password handling format. However, most prepackaged version of php (especially for windows) do not include the mysqli library by default. So, the workaround for using 4.1 is setting your passwords to be stored in the older format (this is set in my.ini), in which case the 3.x/4.0 driver will work in "compatibility" mode. Of course, you can't just change the format... you need to also reset all of your current passwords after you make this change.
It's a sticky situation, and not being handled well by the people prepackaging php. 4.1 is now considered stable and recommended for all new development. PHP should be acknowledging this fact...
I'm just trying to handle it as best I can.
Re: mysqli_real_connect: warning
Posted: Tue Mar 15, 2005 7:54 pm
by jptechnical
Of course, you can't just change the format... you need to also reset all of your current passwords after you make this change.
You are talking bout the database password not the user passwords in the admin right?
I have a bunch of installs all with the older setting, if a new version requires it will I just need to change my database password or am I looking at changing the passwords for users in the admin? When you say reset... what exactly do you mean?
thanks.
Re: mysqli_real_connect: warning
Posted: Tue Mar 15, 2005 7:57 pm
by Ted
Sorry. Yeah, database user passwords. CMSMS passwords are created in php using md5 sums (for database independence reasons)
By reset, I mean actually go back and set the passwords for every database user in mysql.
Make sense?
Re: mysqli_real_connect: warning
Posted: Tue Mar 15, 2005 8:08 pm
by jptechnical
yes, thanks.
Re: mysqli_real_connect: warning
Posted: Fri Apr 01, 2005 10:42 am
by piratos
The mysqli - error must be a adodb error or otherwise.
Test your mysqli - installation as follow and dirctly
Code: Select all
<?php
/*
Zuerst erzeugen wir ein neues Objekt mit dem Namen $mysqli und verbinden uns zum Server. Ab sofort werden wir nur noch auf das Objekt zugreifen
server, user, password, database
*/
$mysqli = new mysqli('localhost', 'root', 'yourpassword', 'cmsfrisch');
/*
Wir prüfen, ob es zu einem Fehler kam beim Verbindungsaufbau mit der Datenbank. Sofern dies zutrifft, brechen wir das Script durch die() ab.
*/
if (mysqli_connect_errno()) {
die("Konnte keine Verbindung herstellen");
}
/*
Wir rufen nun verschiedene Daten aus der Datenbank ab. Sofern die Abfrage erfolgreich war, wird die das Ergebnis in der Variable $result gespeichert. Man beachte, dass wir das Query als Objektfunktion $mysqli->query abrufen
*/
if ($result = $mysqli->query('SELECT content FROM cms_content_props')) {
/*
Hier bilden einen Array und geben das Ergebnis aus
*/
while( $row = $result->fetch_assoc() ){
echo "Inhalt: ". $row["content"];
}
/*
Wir geben den Speicher frei.
*/
$result->close();
}
/*
Dies ist Meldung, sofern keine Daten aus der Datenbank ausgelesen werden können.
*/
else {
echo "Es konnten keine Daten aus der Datenbank ausgelesen werden";
}
/*
Verbindung trennen.
*/
$mysqli->close();
?>
If it run there was an error in adodb or in cms.
You can also run phpmyadmin with mysqli as follow.
change this
Code: Select all
$cfg['Servers'][$i]['extension'] = 'mysql'; // The php MySQL extension to use ('mysql' or 'mysqli')
to
Code: Select all
$cfg['Servers'][$i]['extension'] = 'mysqli'; // The php MySQL extension to use ('mysql' or 'mysqli')
and restart phpmyadmin. Now it will use mysqli.