LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-28-2004, 05:52 PM   #1
machiner
Member
 
Registered: Jun 2004
Location: New England
Distribution: Debian, straight. No chaser.
Posts: 112

Rep: Reputation: 15
mysql


How do I let other proggys know I really do have MySql installed and running?

Is there some path command or something?

THanks
 
Old 07-29-2004, 09:46 AM   #2
machiner
Member
 
Registered: Jun 2004
Location: New England
Distribution: Debian, straight. No chaser.
Posts: 112

Original Poster
Rep: Reputation: 15
I figured irt out

How about this error:

DBI connect failed : Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

I am trying to create a database

machiner
 
Old 07-29-2004, 10:13 AM   #3
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
I know this is obvious but is mysqld running?
 
Old 07-29-2004, 10:35 AM   #4
machiner
Member
 
Registered: Jun 2004
Location: New England
Distribution: Debian, straight. No chaser.
Posts: 112

Original Poster
Rep: Reputation: 15
Thank you for your response.

Yes -- MySql was running. In fact I was unable to shut it down. I used a tutorial with a bunch of typos, but i found this one and am using it to reinstall all apps.
http://www.brtnet.org/linux/lamp.htm

Again, thank you for your response.

I will post success/failure.

machiner
 
Old 07-29-2004, 10:57 AM   #5
machiner
Member
 
Registered: Jun 2004
Location: New England
Distribution: Debian, straight. No chaser.
Posts: 112

Original Poster
Rep: Reputation: 15
Success

Now -- That's a tutorial


machiner
 
Old 07-29-2004, 11:19 AM   #6
machiner
Member
 
Registered: Jun 2004
Location: New England
Distribution: Debian, straight. No chaser.
Posts: 112

Original Poster
Rep: Reputation: 15
nope -- Although mysql installed, and I can now start and stop, and the mysql db exists, I still get this error :

DBI connect failed : Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

I cannot add a user or a new database...or about anything. I follwed the tutorial in my previous post to the letter with NO errors.

Can someone help?

Thanks

machiner
 
Old 07-29-2004, 11:34 AM   #7
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
I don't see a link to a tutorial in your previous post -- does the socket file /var/lib/mysql/mysql.sock exist? Usually mysql.sock is in /tmp. You can specify the path to the socket on the command line with the -S <socket path> option. Also, just for santy's sake, do a ps aux and make absolutely certain mysqld is running.
 
Old 07-29-2004, 11:42 AM   #8
machiner
Member
 
Registered: Jun 2004
Location: New England
Distribution: Debian, straight. No chaser.
Posts: 112

Original Poster
Rep: Reputation: 15
Thanks for your response. Yes the socket exists in that directory.

The tutorial is here:
http://www.brtnet.org/linux/lamp.htm

Here are some supporting images:
http://www.madcarters.com/sql-1.png
http://www.madcarters.com/sql-2.png
http://www.madcarters.com/sql-3.png


machiner


Yes, when I configged the proggy :
./configure \
--prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--disable-maintainer-mode \
--with-mysqld-user=mysql \
--with-unix-socket-path=/tmp/mysql.sock \
--without-comment \
--without-debug \
--without-bench

the path to mysql.sock is indeed temp. But I looked in the directory described in the error message and I found mysql.sock.

how can I use -s to chanfge this in a terminal so I can use mysql.

THank you very much for your help

Last edited by machiner; 07-29-2004 at 11:46 AM.
 
Old 07-29-2004, 11:59 AM   #9
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
If mysqld is running try:

mysql -u root -S mysql_socket

(note that its a capital 'S') and see if you're able to connect. You can set a password for the MySQL root user from within MySQL. I'm not sure what that /var/lib/mysql/mysql.sock is -- can you do an ls -l on it and check its permissions? Also check the permissions on /tmp/mysql.sock -- they should be full permissions for everyone.
 
Old 07-29-2004, 12:39 PM   #10
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
do you have another version of mysql installed on your system?
See if this thread is any help
http://www.linuxquestions.org/questi...hreadid=207122

Last edited by Demonbane; 07-29-2004 at 12:41 PM.
 
Old 07-29-2004, 12:40 PM   #11
linuxlastslonge
Member
 
Registered: Jun 2002
Location: Franklin, IN
Distribution: Debian, CentOS, Mac OS X
Posts: 158

Rep: Reputation: 30
do you have iptables running? that could be blocking mysqld connecting to the local port/socket. if iptables is running, stop the service with the command:

/sbin/service iptables stop
 
Old 07-29-2004, 12:44 PM   #12
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
I think if you connect to mysqld on the localhost it uses unix domain sockets instead of tcp for better performance, so iptables shouldn't matter.
 
Old 07-29-2004, 12:52 PM   #13
machiner
Member
 
Registered: Jun 2004
Location: New England
Distribution: Debian, straight. No chaser.
Posts: 112

Original Poster
Rep: Reputation: 15
fabulous -- lemme go through your responses. Thank you all...To answer Demonbane immediately, I did have another version -- I installed it through MCC in mandrake. I did uninstall it however before I installed this one from source.

machiner
 
Old 07-29-2004, 12:56 PM   #14
machiner
Member
 
Registered: Jun 2004
Location: New England
Distribution: Debian, straight. No chaser.
Posts: 112

Original Poster
Rep: Reputation: 15
1
[root@localhost root]# mysql -u root -S mysql_socket
ERROR 2002: Can't connect to local MySQL server through socket 'mysql_socket' (2)
[root@localhost root]#

I also stopped iptables -- that didn't do it.

1a
[root@localhost root]# ln -s /var/lib/mysql/mysql.sock /tmp
ln: `/tmp/mysql.sock': File exists
[root@localhost root]#


2
Does this lend any insight--
=============from the tutorial, I did this==============
MySQL is "installed" but we have a few more steps until it's actually "done" and ready to start. First run the script which actually sets up MySQL's internal database (named, oddly enough, mysql).

./scripts/mysql_install_db

Then we want to set the proper ownership for the MySQL directories and data files, so that only MySQL (and root) can do anything with them.

chown -R root:mysql /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql/data

Copy the default configuration file for the expected size of the database (small, medium, large, huge)

cp support-files/my-medium.cnf /etc/my.cnf
chown root:sys /etc/my.cnf
chmod 644 /etc/my.cnf

If you get an error message about the data directory not existing, etc., something went wrong in the mysql_install_db step above. Go back and review that; make sure you didn't get some sort of error message when you ran it, etc.

Now we have to tell the system where to find some of the dynamic libraries that MySQL will need to run. We use dynamic libraries instead of static to keep the memory usage of the MySQL program itself to a minimum.

echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
ldconfig

Now we want to set up a startup script, which enables MySQL auto-start each time your server is restarted.

cp ./support-files/mysql.server /etc/rc.d/init.d/mysql
chmod +x /etc/rc.d/init.d/mysql
/sbin/chkconfig --level 3 mysql on

Then we set up symlinks for all the MySQL binaries, so they can be run from anyplace without having to include/specify long paths, etc.

cd /usr/local/mysql/bin
for file in *; do ln -s /usr/local/mysql/bin/$file /usr/local/sbin/$file; done

Time to take care of some security issues.

First, we will assume that only applications on the same server will be allowed to access the database (i.e., not a program running on a physically separate server). So we'll tell MySQL not to even listen on port 3306 for TCP connections like it does by default. Edit /etc/my.cnf and add

skip-networking

to the [mysqld] section.

For more security info, check this great tutorial over at SecurityFocus. The chrooting part won't be too relevant, but all the other info is good to know.

Now we can start the MySQL server!

cd ~
/etc/rc.d/rc3.d/S90mysql start

Let's "test" it to see what version we're running now:

mysqladmin version

Now we'll set a new password for the MySQL root user (not the same as the system root user!)

mysqladmin -u root password new-password
=================================================

machiner

Last edited by machiner; 07-29-2004 at 01:01 PM.
 
Old 07-29-2004, 01:42 PM   #15
machiner
Member
 
Registered: Jun 2004
Location: New England
Distribution: Debian, straight. No chaser.
Posts: 112

Original Poster
Rep: Reputation: 15
By the way -- this did not work...I manually start mysql:

Now we want to set up a startup script, which enables MySQL auto-start each time your server is restarted.

cp ./support-files/mysql.server /etc/rc.d/init.d/mysql
chmod +x /etc/rc.d/init.d/mysql
/sbin/chkconfig --level 3 mysql on

machiner
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 02:13 PM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 07:19 AM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 01:52 AM
Problems with MySQL on SuSE: Can't Connect (/var/lib/mysql/mysql.sock) neocookie Linux - Software 8 02-07-2008 11:48 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration