Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8591291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:29:33+00:00 2026-06-11T23:29:33+00:00

I have just installed a MySQL server (version 3.23.58) on an old RedHat7. I

  • 0

I have just installed a MySQL server (version 3.23.58) on an old RedHat7. I cannot install a more recent MySQL version because of the dependencies. I cannot update librairies on this RedHat server.

However, I have a problem connecting to the database with PHP. First I used PDO but I realized that PDO was not compatible with MySQL 3.23…

So I used mysql_connect(). Now I have the following error:

Warning: mysql_connect(): No such file or directory in /user/local/apache/htdocs/php/database.php on line 9
Error: No such file or directory

My code is:

$host = 'localhost';
$user = 'root';
$password = '';
$database = 'test';
$db = mysql_connect($host, $user, $password) or die('Error : ' . mysql_error());
mysql_select_db($database);

I checked twice that the database exists and the login and password are correct.

This is strange because the code works fine on my Windows PC with Wampp. I cannot figure out where the problem comes from.

Any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:29:34+00:00Added an answer on June 11, 2026 at 11:29 pm

    Yes you can not connect like that!

    @PLB and @jammypeach mysqli is after v4.1, he is using v3 🙂
    Guys read the specs, if you want really to help!

    You can’t connect, because your socket file is a bit wrong. I remember now that the old RH had this issue before.
    Your socket is probably as /var/mysql/mysql.sock or /tmp/mysql.sock but one or more apps are looking for the other.

    If yours is /tmp/mysql.sock but no /var/mysql/mysql.sock you should:

    cd /var 
    mkdir mysql
    cd mysql
    ln -s /tmp/mysql.sock mysql.sock
    

    If you have /var/mysql/mysql.sock but no /tmp/mysql.sock then:

    cd /tmp
    ln -s /var/mysql/mysql.sock mysql.sock
    

    You’ll need permissions to make the changes. Just sudo, if needed before the commands above!

    ANOTHER SOLUTION (easier):

    Create file and call phpinfo(); Look for ‘mysql.default_socket’; or ‘pdo_mysql.default_socket’;
    Open My.ini or My.cnf find the socket value e.g. socket=/tmp/mysql.sock
    Open your php.ini file (which is also found on your phpinfo() page as ‘Loaded Configuration File‘) and change all the occurrences of the incorrect socket location to the correct socket location from MySQL.

    ANOTHER SOLUTION (easiest):
    DSN for PDO:

    mysql:unix_socket=/tmp/mysql.sock;dbname=...
    

    mysql_connect:

    $db = mysql_connect('localhost:/tmp/mysql.sock', ...
    

    Your system is really scary when it comes to security, if you’re hosting sensitive data, I’d upgrade to the latest versions.

    —- UPDATE —-

    Aaahhhh PHP 5.0 and MySQL 3.23 🙂

    PHP 5 has a mysql client packaged that cannot connect to a MySQL database less than version 4.1.
    Starting with version 4.1, MySQL uses a new way of password hashing that is not compatible with pre-4.1 databases. The server your configuration is connecting to is version 3.23. So you need to get yourself a higher version of MySQL. Sorry, but there is no other practical solution for your case. If I was you, I’d upgrade the whole system and install the most recent OS version, if I had to I’d go with Debian and the most recent stable versions of PHP and MySQL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have installed mySQL using sudo apt-get install mySQL-server then i have installed libmysqlclient15-dev
I have Windows Server 2008 R2 with MySQL and Subversion installed separately. Just to
I have Windows Server 2008 R2 with MySQL and Subversion installed separately. Just to
I have a server with a weird internal version of MySQL installed and want
I have just installed MySQL Community Server and now want to create a database
I have just installed that latest stable release of TortoiseSVN on Windows Server 2003
I have just installed Debian Lenny with Apache, MySQL, and PHP and I am
Have just installed Aptana and used MacPorts to update all the extras for a
I have just installed phpMyAdmin on my new Fedora Core 10 dedicated server. I
I just installed mysql server 5.5.20 on my OS X Lion and everything works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.