Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 17 of 17
I can manually get in with mysql -u root -ppass or mysql -u myuser -ppass just not with php script using mysql_connect($host,$usr,$pass)...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Just Joined!
    Join Date
    Mar 2003
    Location
    USA
    Posts
    18

    do I need to reset password


    I can manually get in with
    mysql -u root -ppass
    or
    mysql -u myuser -ppass
    just not with php script
    using mysql_connect($host,$usr,$pass)

  2. #12
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    What error do you get from the script?

  3. #13
    Just Joined!
    Join Date
    Mar 2003
    Location
    USA
    Posts
    18

    error

    ERROR: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) ERROR: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) CREATE TABLE links ( id INT NOT NULL AUTO_INCREMENT, sitename VARCHAR(50), siteurl VARCHAR(75), description TEXT, category VARCHAR(50), PRIMARY KEY(id) ); Links Results RESULT =

  4. #14
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    In that case, I just think that PHP is configured to use the wrong MySQL socket path. I think MySQL puts the socket in /var/lib/mysql/mysql.sock by default. That's probably something you can configure at compile time.

  5. #15
    Just Joined!
    Join Date
    Mar 2003
    Location
    USA
    Posts
    18

    what exactly is the sock?

    is the mysql.sock dynamically created there?
    find -name "mysql.sock" from / gives me nothing?

  6. #16
    Just Joined!
    Join Date
    Mar 2003
    Location
    USA
    Posts
    18

    I think you are right

    Now I just need to figure what compile I need to do to get that socket directory right. If I try to login to mysql before the daemon is running I get a socket error in /var/lib/mysql/mysql.sock like you said.
    any hints on the compile ...
    the compile has --with-mysql do I put --with-mysql=/var/lib/mysql/ or is that only the socket area?

  7. #17
    Just Joined!
    Join Date
    Mar 2003
    Location
    USA
    Posts
    18

    changes

    /usr/local/apache/php/php.ini
    changed mysql_default_socket=
    to
    mysql_default_socket=/var/lib/mysql

    now I get the error as above but with /var/lib/mysql/sock instead of /tmp/sock

    also tried to change my.cnf socket to /tmp but that didn't seem to work either.

    Edit...
    progress.
    found that I needed to add to my.cnf
    [client]
    socket=/tmp/mysql.sock
    and
    in [mysqld]
    change
    socket to
    socket=/tmp/mysql.sock

    now I don't get that error but get links results results = 1
    whatever that means.
    thanks for your help

Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •