Problems connecting to mysql using phpMyAdmin

Ryan Schmidt ryandesign at macports.org
Fri Nov 19 00:09:59 PST 2010


Well something like:

<?php echo (int)mysql_connect('localhost', 'root', 'password');

replacing "password" with your root password. If it connects, it will print the connection number (greater than zero). If it fails, it will print error messages and then 0.

Try running it from the command line ("php mytest.php") and also from a web server (http://localhost/mytest.php).



On Nov 19, 2010, at 02:06, Ali A Samii wrote:

> Would you be able to provide me with the one line to put in the script?
> 
> On 19 Nov, 2010, at 08:53 , Ryan Schmidt wrote:
> 
>> The docroot should have no effect on your ability to connect to the MySQL server.
>> 
>> You can check whether you are using the old password algorithm by looking for a file called my.cnf and seeing if it contains a line "old-passwords" or similar.
>> 
>> To rule out phpmyadmin as the problem, you could try to write a one-line PHP script to connect to the database and print out whether it was successful. You can try to run this through apache as a web page, and also on the commandline ("php mytest.php"), to see if you get different results.
>> 
>> 
>> On Nov 19, 2010, at 01:49, Ali A Samii wrote:
>> 
>>> Hi:
>>> 
>>> I am assuming, because I'm not sure how to check this) that the mysql server is NOT configured to use the "old" password algorithm. This is a fresh and clean install, using the MAMP wiki on trac.macports.com and a fresh install of all the various components and variants.
>>> 
>>> Using the same basic installation process (but with my documents root in the default /opt/local/apache2/..... hierarchy on another machine, I had no problems. The only difference here is the doc root.
>>> 
>>> On 19 Nov, 2010, at 08:44 , Ryan Schmidt wrote:
>>> 
>>>> Yes, your answer did get through, I just didn't have a response yet.
>>>> 
>>>> Only reason I can think of why you could connect to the MySQL server on the command line but not from PHP:
>>>> 
>>>> Is your MySQL server (or this root account, anyway) configured to use the "old" (MySQL < 4.1) password algorithm? If so that doesn't work with mysqlnd (which is what php5-mysql now uses by default) so you should either (ideally) upgrade to the "new" algorithm or if you must keep the old algorithm, then install php5-mysql with the +mysql5 variant.
>> 
> 



More information about the macports-users mailing list