Results 1 to 2 of 2
  1. #1

    Installed MySQL in /usr/local/mysql but error in /var/lib/mysql


    I installed the MySQL binary packages in /usr/local/mysql/ after removing the MySQL RPM package. MySQL is functioning when I executed /usr/local/mysql/bin/safe_mysqld. I reinstalled MySQL before I installed PHP. When I used a PHP script to access a MySQL database, it outputs an error:
    Warning: mysqli::mysqli() [function.mysqli-mysqli]: (HY000/2002): can't connect to local mysql server through socket /var/lib/mysql/mysql.sock in index.php on line 2
    However, I installed MySQL in /usr/local/mysql, not in /var/lib/mysql. How do I fix MySQL?

    Thank you all very much.

  2. #2
    Join Date
    Jan 2005
    Scotland, UK
    /var/lib/mysql is likely your data-dir if your data-dir is /usr/local/mysql/data then define the sock in php.ini or symlink it.
    Server Management -
    Infrastructure Management, Web Application Performance, mySQL DBA. System Automation.
    WordPress/Magento Performance, Apache to Nginx Conversion, Varnish Implimentation, DDoS Protection, Custom Nginx Modules
    Check our wordpress varnish plugin. Contact us for quote: [email protected]

Posting Permissions

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