MySQL is not working on PHP with Fedora 16

Fedora Linux fedoralinux at toursbymexico.com
Wed Jan 25 01:59:12 UTC 2012


Hello

$ ps -eZ | grep mysql
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 5859 pts/1 00:00:00
mysqld_safe
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 5985 pts/1 00:00:00
mysqld

I have installed these MySQL packages (Fedora 16 x64):

mysql-connector-odbc-5.1.8-3.fc16.x86_64
mysql-devel-5.5.17-1.fc16.x86_64
MySQL-python-1.2.3-3.fc16.x86_64
mysql-server-5.5.17-1.fc16.x86_64
qt-mysql-4.8.0-0.23.rc1.fc16.x86_64
php-mysql-5.3.8-3.fc16.x86_64 <==============
mysql-5.5.17-1.fc16.x86_64
mysql-connector-java-5.1.17-1.fc16.1.x86_64
mysql-embedded-5.5.14-3.fc16.x86_64
libdbi-dbd-mysql-0.8.3-8.fc16.x86_64
perl-DBD-MySQL-4.019-3.fc16.x86_64
mysql-libs-5.5.17-1.fc16.x86_64

And these PHP packages:

php-common-5.3.8-3.fc16.x86_64
php-ldap-5.3.8-3.fc16.x86_64
php-pdo-5.3.8-3.fc16.x86_64
php-5.3.8-3.fc16.x86_64
php-mysql-5.3.8-3.fc16.x86_64 <==============
php-cli-5.3.8-3.fc16.x86_64

These are the packages that come with the Fedora distribution and/or
repos...

I have just started MySQL and tried again...

# mysqld_safe --user=mysql
120124 19:39:39 mysqld_safe Logging to '/var/log/mysqld.log'.
120124 19:39:39 mysqld_safe Starting mysqld daemon with databases from
/var/lib/mysql

/var/log/mysqld.log :
120123 12:25:25 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid
ended
120124 19:39:39 mysqld_safe Starting mysqld daemon with databases from
/var/lib/mysql
120124 19:39:40 [Note] Plugin 'FEDERATED' is disabled.
120124 19:39:40 InnoDB: The InnoDB memory heap is disabled
120124 19:39:40 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120124 19:39:40 InnoDB: Compressed tables use zlib 1.2.5
120124 19:39:40 InnoDB: Using Linux native AIO
120124 19:39:40 InnoDB: Initializing buffer pool, size = 128.0M
120124 19:39:40 InnoDB: Completed initialization of buffer pool
120124 19:39:40 InnoDB: highest supported file format is Barracuda.
120124 19:39:40  InnoDB: Waiting for the background threads to start
120124 19:39:41 InnoDB: 1.1.8 started; log sequence number 1690783
120124 19:39:42 [Note] Event Scheduler: Loaded 0 events
120124 19:39:42 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.17'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL
Community Server (GPL)

and /var/log/httpd/error_log :

[Tue Jan 24 19:45:05 2012] [error] [client ::1] PHP Warning:
 mysql_connect(): Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (13) in /var/www/html/install2.php on line 22,
referer: http://localhost/install.php

BUT I can connect manually from the console... note that the user and
password are right, I added a print line on the PHP code with the
host/user/pass and it shows them correct, so it is not due an incorrect
login...

the line 22 from install2.php:

$my_handle = mysql_connect($my_host,$admin_user,$admin_pass);

and it works fine on the production server, so it is not the application...

Apparently the problem is not on the MySQL side, it should be the PHP or
the connector from PHP to MySQL... or I don't know, it simply does not work
:(

What can I do? I need to test and run the application on my local computer
not the server


Thanks!

On Mon, Jan 23, 2012 at 12:40 PM, Daniel J Walsh <dwalsh at redhat.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 01/23/2012 01:22 PM, Fedora Linux wrote:
> > # setsebool httpd_can_network_connect_db on
> >
> > I have just tried, but still does not work:
> >
> > Can't connect to local MySQL server through socket
> > '/var/lib/mysql/mysql.sock' (13)
> >
> > Any other idea?
> >
> > Connecting manually it works
> >
> What AVC's are you seeing.  Most likely mysql is not running with the
> correct context.
>
> ps -eZ | grep mysql
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.fedoraproject.org/pipermail/users/attachments/20120124/6b39029a/attachment.html>


More information about the users mailing list