Red Hat / Fedora :: MySQL Can't Connect From PHP (12)
Apr 26, 2010
We just set up a new Fedora 12 server. It can't connect from PHP....we're really stumped. Here's what we did to troubleshoot:Connected successfully (remote) from Workbench Connected successfully as the web site user from CLI Checked (and reinstalled) the php-mysql package Turned off iptables, no change installed mysql-devel packages We've got a drupal site installed and it does a function that checks if mysql_connect exists. Drupal says the function doesn't exist, so it's like PHP doesn't even see mysql. Now, we didn't uncomment the extension=mysql.so line in php.ini, but I checked my cPanel Cent machine and it wasn't uncommented there either, so I assume it doesn't have to be on Fedora/RHEL/Cent.
We installed from yum, we did NOT compile Apache/PHP/MySQL. We'd prefer not to if possible. UPDATE: We are running on a VPS and we had enabled mpm.worker (ie, we uncommented the worker line in /etc/sysconfig/httpd). Once we went back to using prefork, all is well. Apparently you have to compile php/apache to use worker.
I've been attempting to set up a LAMP for local web development, which meant installing mysql-server. But now have a problem when trying to run mysql, I get:-
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
When trying to downgrade mysql-server I saw that there are dependency problems between the various modules (but can't recall which). But whichever route I truied the results are always the same.
Thought about trying XAMPP but I note that even has it's problems, is there any way I can get a lamp set up on FC14, or must I give it up as a bad job.
Howver, just been trying to again to fix the problems with downgrading mysql and get:-
I think this goes here, but I'm not sure. I decided that XAMPP had been troublesome enough. MySQL never worked. So I decided to instal the LAMP stack offered by YaST. I went about installing it thinking that it would all work. But it seems that I was wrong. So I try to start mysql, and here's what I get:
Code: the-matrix:~ # mysql start ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2) or Code: the-matrix:~ # rcmysql start Starting service MySQL warning: /var/mysql/mysql.sock didn't appear within 30 seconds chmod: cannot access `/var/run/mysql/mysqld.pid': No such file or directory
i am using liferay5.2(mysql included in the download pack) on fedora. while liferay is working fine but i cannot connect to mysql.i am getting the error
[ [root@localhost ~]# ln -s /var/lib/mysql/mysql.sock /tmp [root@localhost ~]# /etc/init.d/mysqld start Timeout error occurred trying to start MySQL Daemon.
[code]....
i didnt find the mysql.sock file in the location /var/lib/mysql/mysql.sock. i cannot find the portal-ext.properties file also to make intial settings.
I'm having problems connecting to the mysql database on my system. I first noticed this when I was trying to set up the program anymeal. I subsequently tried using MySQL Administrator (mysql-admin), but had no luck. It gives my the following feedback:
Code:
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Click the 'Ping' button to see if there is a networking problem. I press the ping button, and it seems to connect.
I've downloaded and installed MySQL-client-5.1.53-1.glibc23.x86_64.rpm. I'm rather new to linux so it might be I haven't started the server. Unfortunately I have no idea which file is responsible for that. It is also possible that my head isn't functioning correctly ( if at all ).
Error I receive is:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I have a fedora machine have apache server and from the .php on this page I am trying to connect to mysql database on another pc on my lan. But I get this error Failed to connect to server: Can't connect to MySQL server on '192.168.1.21' (13). What can be possible error? I dont know what else to search? I have php info page and can see the mysqli on this apache server?
I installed Fedora 12 with package standard of the MYSQL, configured this the same twirling in such a way localhost as in one it schemes with windows VISTA, to put I have others 4 you scheme with windows XP that I do not obtain to have access in the MYSQL. What I have to make pra these you scheme with XP to have access?
I have just migrate from UBUNTU to Fedora 11. Tried to install cacti by 'yum install cacti' everything presumably went correctly. But when trying to get cacti running on a browser it's showing:
Code: FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php' Checked everything else including installing new mysqld-server (using yum install) and still not working.
Trying the installation steps from [URL], but could not find where mysql was installed. Mysqld should already be running, cos I can see it using webmin-server-mysql. Did a test as shown on [URL], everything seems ok. No major problem when using UBUNTU with apt-get install.
I'm using fedora 13(x86_64).i got an error message while starting the mysql database software through the kernel. Code: [pradeep@localhost ~]$ mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) [pradeep@localhost ~]$ this is the first time i'm using the mysql in linux environment. do i have to configure anything before using it for the first time ?!
So the problem is that phpMyAdmin does not want to connect to host name (at remote server) but connects to that same server fine if it's ip address is used. Command line "mysql -h hostname ..." works fine and connects to host name. Mysqladmin also works.
it's giving error:
***** Error
MySQL said: #2005 - Unknown MySQL server host 'host.name' (2) ******
I've disabled SElinux and temporarily disabled Iptables but no luck.
Somehow I feel MySQL is not doing DNS lookup when used by Apache/PHP. So it just understands ip addresses.
I found that on MySQL startup you can disable DNS lookup. [URL] Not sure if it's disabled and how to enable it at startup. Could not find anything at "System" -> "Administration" -> "Services".
I was trying to install MySQLbd (a module for python to connect and access MySQL) I followed these steps for installation[URL].. but while I am getting some installation errors. When I try to run $ python set.py build I am getting the following errors (I removed few errors as I can post more than 10000 characters here)
I am getting the following error when starting mysql using 'sudo /etc/init.d/mysql start':
Mar 15 16:33:56 MoodFishDev /etc/init.d/mysql[18317]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in Mar 15 16:33:56 MoodFishDev /etc/init.d/mysql[18317]: ^G/usr/bin/mysqladmin: connect to
I wrote a code in C to connect to MySQL by using mysql_real_connect function but I recieved error "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)" (by using mysql_error function).
I also did the following things: in mysql I typed 'SHOW VARIABLES LIKE '%SOCKET%'', it returned /var/lib/mysql/mysql.sock I typed 'mysql_config --socket' in shell, it returned /var/lib/mysql/mysql.sock I modified /etc/my.cnf file
I've setup a CentOS apache web server, and loaded a site onto it. The site previously was functioning under windows xp (before I "stepped in") and wamp. What I did was copy the site in /var/www, reconfigure the httpd.conf (DocumentRoot /var/www/site, etc). Although when I try to open the webpage I get this error: Database Error: Unable to connect to the database:The MySQL adapter "mysql" is not available.
Mysql starting problem after changing mysqladmin password.I tried all the solutions available on forums, but not solve the problem.At last I restored the mysql db backup, this make mysql service start, but till other databases not showing all tables.
I cannot connect to mysql on my server.It is running but I cannot remember whether it has a password or not.I get this: [root myscripts]# mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)[root myscripts]#.I have tried running mysql -u root -h localhost -p and entering a blank password but no luck.
I've just decided to jump in and learn some PHP and MySQL stuff, by creating a dbase on our intranet server (CentOS5.4/Apache/PHP).
Everything seemed to go great with the MySQL dbase creation - I can even successfully connect to the dbase via ODBC on a Windows box (but there's no data in there yet).
My next step was to create a PHP form to gather info from intranet users, which would be submitted to and stored in the MySQL dbase.
I have tried following various basic tutorials online but I have started to struggle. If I run even the most simple of PHP connection on the server, I just get a blank page (i.e.: no 'connected' or 'failure to connect' message).
For instance:
<?php mysql_connect("localhost", "admin", "1admin") or die(mysql_error()); echo "Connected to MySQL<br />"; ?>
If I run this, I get a blank page.
How can I start to troubleshoot this? As mentioned I felt quite confident that MySQL was working due to success with ODBC, and the server already serves html/PHP services/pages as it's an existing intranet server.
I am looking for some advice on the best way to connect to a MySQL database on a Ubuntu server via SSH. The application is built using VB6 and is installed on a Windows server.
I am in the process of installing a genome brower on an ubuntu 10.04 (lucid). I achieved to see the browser once. Then, the mysql.sock disappeared and to solve this I tried first, to reboot the server with no results. Then I removed and reinstalled the MySQL server installing mysql-server-5.1. Now, I have a socket and MySQL is running (checked these out) but when I try to see the browser that is what I obtain:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
I'm trying to run php scripts on Kubuntu 10.04 that connect to a MySQL database. These scripts run perfectly on OS X 10.6.6, but when I run them in Kubuntu, I get the following error: The script...
[Code]...
The error message: "Fatal error: Call to undefined function mysql_connect() in..." I've seen some posts in other boards about Red Hat problems like this, but nothing that can help with Kubuntu.
I'm using ubuntu 10.04 LTS I install mysql..Code: sudo apt-get install mysql-server.I set up my password and confirm,I type mysql at the terminal and i get this back.
I want to learn mysql ! i have a pc with no lan/wan connections (i mean no server-client relation) i installed mysql using synaptic , when it was installing mysql,it asked me for password (opened a window) then i typed in terminal
Running MYSQL 5.5.12 and MYSQL Workbench 1:5.2.34 on up-to-date Arch linux Set up MYSQL with root account and password. When running Workbench as user, got error when trying to connect :
Quote:
Cannot Connect to Database Server Your connection attempt failed for user 'root' from your host to server at 127.0.0.1:3306: Can't connect to MySQL server on '127.0.0.1' (111)
1 Check that mysql is running on server 127.0.0.1
2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines)
4 Make sure you are both providing a password if needed and using the correct password for 127.0.0.1 connecting from the host address you're connecting from
After commenting #skip-networking in my.cnf error changed to :
Quote:
Cannot Connect to Database Server Your connection attempt failed for user 'root' from your host to server at 127.0.0.1:3306: Lost connection to MySQL server at 'reading initial communication packet', system error: 0
1 Check that mysql is running on server 127.0.0.1
2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines)
4 Make sure you are both providing a password if needed and using the correct password for 127.0.0.1 connecting from the host address you're connecting from
Copying my.cnf to /etc/ and running Workbench as root didn't change anything, i still get the second error The wiki [URl] says to enable MYSQL in /etc/hosts.allow but i didn't do it, i guess it is required only when trying to access MYSQL from remote hosts which i dont.
I been going off old outdate guides and informaion around the internet and nothing is working
I have 2 Servers Server A running apache, php, phpmyadmin Sever B running MySQL Server A has IP of 192.168.1.110 Server B has IP of 192.168.1.120
[Code]...
(This par was confusing to I just re-added the line above instead of searching for it all).
Then I set the MySQL vi /etc/mysql/my.cnf to comment out #bind-address = 127.0.0.1 There is another line that most of the guides asked me to comment out but I cannot find that like: # skip-networking
The Next closest match to that is: skip-external-locking
I will assume that is not it and leave it alone....
I keep getting errors for example: "Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly"
Another error was it canno connect because it is not accepting connections from the IP Address of my webserver..
I am getting this error when I try to connect to my MySQL database from a PHP page. MySQL is working fine on it's own and PHP is working on it's own. "Fatal error: Call to undefined function mysql_connect() in /usr/local/htdocs/test.php on line 11" I have found instances on the Internet where other people had the same problem but from everything I've read, none of it appears to do anything for me. I have read that I need the "extension=mysql.so" in my php.ini file and to uncomment it but it's not in there and I don't even have the "mysql.so" file. Many people have said to install the MySQL "devel" package, which I have also done and it is still not adding the file. (Tried "rpm -i php-mysql") I have also tried running the PHP ./configure again with the "--with-mysql". After all of these I still can't seem to get any further than I was when I found out I had a problem