Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Location: Nieuwerkerk aan den IJssel (near Rotterdam, The Netherlands)
Distribution: Gentoo, Slackware, Debian
Posts: 156
Rep:
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?
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.
Location: Nieuwerkerk aan den IJssel (near Rotterdam, The Netherlands)
Distribution: Gentoo, Slackware, Debian
Posts: 156
Original Poster
Rep:
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?
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.
Location: Nieuwerkerk aan den IJssel (near Rotterdam, The Netherlands)
Distribution: Gentoo, Slackware, Debian
Posts: 156
Original Poster
Rep:
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?
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.
Location: Nieuwerkerk aan den IJssel (near Rotterdam, The Netherlands)
Distribution: Gentoo, Slackware, Debian
Posts: 156
Original Poster
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.