XAMPP and mysqli() Connection error (2002)

Discussion in 'Web Design and Development' started by Gr1pp, Feb 26, 2011.

  1. Gr1pp, Feb 26, 2011
    Last edited: Feb 26, 2011

    Gr1pp macrumors newbie

    Joined:
    Feb 26, 2011
    #1
    first thing is first, phpMyAdmin works, and i can add db's and users.... so it would seem that mysql is running.

    but when sending mysqli(localhost, user, pw) i get:

    Code:
    Connection error (2002) No such file or directory
    i added "mysql.default_socket = /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock" to /Applications/XAMPP/xamppfiles/etc/php.ini

    first and restarted apache and mysql. still a no go.

    so to check that it is actually mysql running the phpMyAdmin page, and not say sqlite fooling me, i ran:


    Code:
    # ./mysqladmin version
    ./mysqladmin  Ver 8.42 Distrib 5.1.44, for apple-darwin8.11.1 on i386
    Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
    This software comes with ABSOLUTELY NO WARRANTY. This is free software,
    and you are welcome to modify and redistribute it under the GPL license
    
    Server version          5.1.44
    Protocol version        10
    Connection              Localhost via UNIX socket
    UNIX socket             /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
    Uptime:                 43 min 1 sec
    
    Threads: 1  Questions: 383  Slow queries: 0  Opens: 476  Flush tables: 1  Open tables: 4  Queries per second avg: 0.148
    not sure here, but mysqladmin wasn't a command available - i had to navigate to /Applications/XAMPP/xamppfiles/bin to run it like a script.

    so any suggestions?

    edit: found that i can connect and use db thru MySQL Workbench. but still not mysqli. ..
     
  2. Gr1pp thread starter macrumors newbie

    Joined:
    Feb 26, 2011
    #2
    got it.

    the problem was that XAMPP was not adding the password i had used for the user that i had created.

    i figured this out when i was able to log into the table thru workbench with the user - so long as i didn't supply the password.

    so i ran the xampp security to enable/add passwords, then deleted/recreated the db and user and used workbench to check that everything was fine.


    oddly, however, the mysql.default_socket = /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock part didn't work when i tried to create the tables. so i created a symlink:

    Code:
    sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql/ /var/mysql
    and so far so good. i just wish XAMPP would have simply ran a normal installer that placed things where they were supposed to be and didn't do whatever it was they did which prevented the new user from having a password. just painful stupidity.
     

Share This Page