LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   xampp mysql.sock problem (https://www.linuxquestions.org/questions/linux-server-73/xampp-mysql-sock-problem-628099/)

konqi 03-14-2008 03:48 PM

xampp mysql.sock problem
 
i use xampp to learn php, but when i make a database with php, and open the php file, it gives errors that it can't open mysql.sock. I searched for but it's isn't somewhere on the drive.

How can i fix this? Is there a way to use a .sock file from someone else?

acid_kewpie 03-14-2008 04:16 PM

please search this site for a million identical questions... start by scrolling down to the bottom of this page. generally you've not got mysql running.

konqi 03-15-2008 05:08 AM

I have installed myqsl, but is this necessary? Mysql is already in xampp.

I started mysqld with:
Code:

root@helios:~# /etc/rc.d/rc.mysqld start
Then i run this to test if it works:

Code:

mysql@helios:~$ /usr/bin/mysqladmin ping
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysql/mysql.sock' exists!
mysql@helios:~$

But as you can see, it stil doesn't work. I have searched for mysql.sock, but it doesn't exist. What do i have to do know?

I have searched mysql downloads, but none have a mysql.sock file. Is there a way to create it?

datopdog 03-15-2008 06:00 AM

I think xamp installs under /opt so the socket should be under that directory, it seems like your mysql client is searching under /var/lib/mysql where the normal rpm creates the socket.

When you find it edit your /etc/my.cnf and point the socket to the correct location.

konqi 03-15-2008 08:09 AM

yes xampp is installed under /opt/.

But also in /opt/ there is no mysql.sock file. It doesn't exists on my harddrive.

acid_kewpie 03-15-2008 08:48 AM

the file won't exist unless mysql is running. it disappears when it isn't running. does "pidof mysqld" show it is running?

datopdog 03-15-2008 10:21 AM

Am sure xamp has a my.cnf file installed, find it and see where the socket is set to then edit your /etc/my.cnf and point to the same location.

konqi 03-15-2008 02:27 PM

mysqld is running:

Code:

root@helios:~# pidof mysqld
2941

i have found the mysql.sock file in /var/run/mysql, but i can't copy it:

Code:

root@helios:~# cp /var/run/mysql/mysql.sock /opt/lampp/var/mysql/
cp: cannot open `/var/run/mysql/mysql.sock' for reading: No such device or address

When i make a link to it with the -sf options, i doesn't give any errors, but still on the php file it gives these errors:

Code:

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2) in /home/frank/oosterpower/index.php on line 22
 
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/frank/oosterpower/index.php on line 22

I have noticed that after some time (or something else, i don't know) the /var/run/mysql/mysql.sock file disappears.

Why does the disappears, and why can't i copy the mysql.sock file to another location. Why does the link not work?

acid_kewpie 03-15-2008 02:54 PM

if it disspears it must've crashed / aborted due to invalid config or some such. step outside of your problem as you've seen it, just focus on mysql, use the mysql client itself to just try to connect.

konqi 03-22-2008 03:16 AM

i ran this command from reply #8 with mysql installed from the slackware pkgs:
Code:

root@helios:~# pidof mysqld
2941

But when i run it, without it installed (only via lampp), it doens't give any output.

But when i run /opt/lampp/lampp security (to set some passwords etc):
Code:

XAMPP: Quick security check...
XAMPP: Your XAMPP pages are secured by a password.
XAMPP: Do you want to change the password anyway? [no]
XAMPP: MySQL is accessable via network.
========================== This is probably important ==================================
XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes]
XAMPP: Turned off.
XAMPP: MySQL has to run before I can check the security.
XAMPP: MySQL has to run before I can check the security.
========================================================================================
XAMPP: ProFTPD has a new FTP password. Great!
XAMPP: Do you want to change the password anyway? [no]
XAMPP: Done.

Is also tried this: (after activiting lampp)
Code:

root@helios:/opt/lampp/htdocs/xampp/lang# /opt/lampp/lampp stopmysql
XAMPP: MySQL isn't running...

to test if mysql is running, but also here it says it isn't running.

Why does mysql not work?

simplicissimus 03-22-2008 07:42 AM

lack of permission
 
The MySQL socket file is created at runtime, provided that MySQL is allowed to create any file in the location defined by my.cfg.

I would check if that location is either world-writeable or at least has mysql set as user and group.

This type of socket error is usually due to the lack of permissions.

Hope this helps,
Regards,
SIMP

Fedora Development

konqi 03-22-2008 02:51 PM

It works! It was just an permission issue.

Really thanks simplicissimus!


All times are GMT -5. The time now is 01:37 AM.