Problems connecting to mysql using phpMyAdmin
Ali A Samii
samii at me.com
Fri Nov 19 00:17:53 PST 2010
Well, from the browser, I got the following when I ran the phptest.php
( ! ) Warning: mysql_connect() [function.mysql-connect]: [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in /Volumes/External_Storage/www/phptest.php on line 2
Call Stack
# Time Memory Function Location
1 0.0193 634680 {main}( ) ../phptest.php:0
2 0.0194 634968 mysql_connect ( ) ../phptest.php:2
( ! ) Warning: mysql_connect() [function.mysql-connect]: No such file or directory in /Volumes/External_Storage/www/phptest.php on line 2
Call Stack
# Time Memory Function Location
1 0.0193 634680 {main}( ) ../phptest.php:0
2 0.0194 634968 mysql_connect ( ) ../phptest.php:2
0
and from the command line, the result was:
Alis-iMac:www ali$ php phptest.php
PHP Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in /Volumes/External_Storage/www/phptest.php on line 2
PHP Stack trace:
PHP 1. {main}() /Volumes/External_Storage/www/phptest.php:0
PHP 2. mysql_connect() /Volumes/External_Storage/www/phptest.php:2
Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in /Volumes/External_Storage/www/phptest.php on line 2
Call Stack:
0.0003 626664 1. {main}() /Volumes/External_Storage/www/phptest.php:0
0.0232 626952 2. mysql_connect() /Volumes/External_Storage/www/phptest.php:2
PHP Warning: mysql_connect(): No such file or directory in /Volumes/External_Storage/www/phptest.php on line 2
PHP Stack trace:
PHP 1. {main}() /Volumes/External_Storage/www/phptest.php:0
PHP 2. mysql_connect() /Volumes/External_Storage/www/phptest.php:2
Warning: mysql_connect(): No such file or directory in /Volumes/External_Storage/www/phptest.php on line 2
Call Stack:
0.0003 626664 1. {main}() /Volumes/External_Storage/www/phptest.php:0
0.0232 626952 2. mysql_connect() /Volumes/External_Storage/www/phptest.php:2
On 19 Nov, 2010, at 09:09 , Ryan Schmidt wrote:
> 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.
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20101119/e157e73a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2659 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20101119/e157e73a/attachment.bin>
More information about the macports-users
mailing list