LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-21-2002, 08:52 PM   #1
Staz
LQ Newbie
 
Registered: Aug 2002
Distribution: Red Hat 7.3 (Console Only)
Posts: 13

Rep: Reputation: 0
Mysql (Socket Issue)


I installed Red Hat 7.3 then installed Apache with PHP and finally installed the rpm for Mysql. It is suposably starting on boot and if I try to start it again it informs me something is already running on that port. When I try to run phpMyAdmin it tells me it can't connect on socket /tmp/mysql.sock (Note: I have tried other scripts that use mysql plus I have gotten phpMyAdmin to work on Weeendowz.) I thought that maybe my firewall was blocking access to the port (3306 if I am not mistaken) so next time I installed Red Hat I enabled I added 3306:tcp to the permitted ports/protocols but no success, I am still having the same problem. I searched for a fix but was unable to find one. I would appreciate any tips or links.

Thanks A Bunch!
 
Old 09-21-2002, 09:36 PM   #2
ToeShot
Member
 
Registered: Nov 2001
Location: Near Chicago
Distribution: FC5, Solaris 10, WinXP
Posts: 152

Rep: Reputation: 30
you need to look and see if you have the mysql.sock file, it will be found in your temp directory.

shell$> cd /tmp
shell$> ls

if you do not see the file then use the touch command to create it

shell$ touch /tmp/mysql.sock.

I am going to assume that you do not have that file since you phpMyAdmin could not find it.

This should help
 
Old 09-22-2002, 09:00 PM   #3
Staz
LQ Newbie
 
Registered: Aug 2002
Distribution: Red Hat 7.3 (Console Only)
Posts: 13

Original Poster
Rep: Reputation: 0
Socket creation...

How would I create the mysql.sock file? A link will do.

Thanks
 
Old 09-23-2002, 02:06 AM   #4
ToeShot
Member
 
Registered: Nov 2001
Location: Near Chicago
Distribution: FC5, Solaris 10, WinXP
Posts: 152

Rep: Reputation: 30
Creating a sock

a couple of ways.

one was is to use a text editor and create a blank file and save it to /tmp/mysql.sock

another way is to use the touch comand,

shell prompt$> touch /tmp/mysql.sock

with both of these methods you will need write permision to the tmp directory.
After the file is created you should change the owner an group of the file to mysql.


this will change owner and group

shell prompt$> chown mysql.mysql /tmp/mysql.sock

then you need to change permision

shell prompt$> chmod 7774 /tmp/mysql.sock

this sets the userid then gives owner and qroup read, write and execute permisions and gives everyone else read permision. I don't think you need to give everyone else the write and execute permisions.

It doesn't matter that the file is empty Mysql uses it like a pipe and never leaves anything in it anyways.
You may need to do this as root user to set the userid.

After all of this is said this still may not resolve the true problem. When the MySql Daemon is started it should create this file for you before it starts the actual server.

Let me know how it goes.

HTH
 
Old 09-23-2002, 03:34 PM   #5
Staz
LQ Newbie
 
Registered: Aug 2002
Distribution: Red Hat 7.3 (Console Only)
Posts: 13

Original Poster
Rep: Reputation: 0
It changed the error number but this is the problem that I am still getting.

MySQL said:

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)
 
Old 09-23-2002, 04:32 PM   #6
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
how do u start the server. it might be the wrong command.
cause usually u can't go wrong installing rpms.

i build mysql from source an start it
./bin/safe_msqld --user root &
this should be working on your box too
maybe it cant create the sock connection cause you don't have permissions for that. but as i said before rpms are pretty safe
good luck
jens
 
Old 09-23-2002, 05:02 PM   #7
Staz
LQ Newbie
 
Registered: Aug 2002
Distribution: Red Hat 7.3 (Console Only)
Posts: 13

Original Poster
Rep: Reputation: 0
Starts...

I installed a binary distrobution and it is supposed to start when my computer starts. If I try to start it again it sais something is already running on that port.
 
Old 09-23-2002, 05:30 PM   #8
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Just creating the file /tmp/mysql.sock will not work.
Because it is a socket. Not a TCP or UDB networking socket, but a UNIX filesystem socket. Since it's not connected to a network, only processes (like PHP, or the mysql-client) on the same computer can connect to it. This makes it more secure.

MySQL should create it by itself when it starts, and listen on the socket to talk through it to its clients.

Such a socket should be visible though using "ls /tmp", so if it is not there, the MySQL daemon didn't create it. There must be something else wrong.

Maybe PHP doesn't have the file-system rights to read/write to it.
Did you try connecting to the database with a 'normal' mysql client?
 
Old 09-24-2002, 12:21 AM   #9
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
what command do u give it to start at boot?
 
Old 09-24-2002, 11:18 AM   #10
ToeShot
Member
 
Registered: Nov 2001
Location: Near Chicago
Distribution: FC5, Solaris 10, WinXP
Posts: 152

Rep: Reputation: 30
Sorry about the mysql.sock file. I could have sworn I read that some where in this forum.

Have you done a

command prompt$> ps -ax | more

you should see some where in that list of processes the line

/bin/sh ./bin/mysql_safe --user=mysql

if you see this then you need to check your my.cnf file. You can find it /etc/my.cnf

if it is not there the do a find command

command prompt&> find / -name my.cnf

if this command does not give you a result then this file needs to be made . This file defines the the mysql.sock as a socket file and is how it is created when mysqld is started.

below is a copy of what I have for my modest system


# Example mysql config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# a important part and systems up to 128M very MySQL is used together with
# other programs (like a web server)
#
# You can copy this file to
# /etc/mf.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /usr/local/mysql/var) or
# ~/.my.cnf to set user-specific options.
#
# One can in this file use all long options that the program supports.
# If you want to know which options a program support, run the program
# with --help option.

# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
set-variable = key_buffer=16M
set-variable = max_allowed_packet=1M
set-variable = table_cache=64
set-variable = sort_buffer=512K
set-variable = net_buffer_length=8K
set-variable = myisam_sort_buffer_size=8M
log-bin
server-id = 1
safe-show-database


# Point the following paths to different dedicated disks
#tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#set-variable = bdb_cache_size=4M
#set-variable = bdb_max_lock=10000

# Uncomment the following if you are using Innobase tables
#innodb_data_file_path = ibdata1:400M
#innodb_data_home_dir = /usr/local/mysql/var/
#innodb_log_group_home_dir = /usr/local/mysql/var/
#innodb_log_arch_dir = /usr/local/mysql/var/
#set-variable = innodb_mirrored_log_groups=1
#set-variable = innodb_log_files_in_group=3
#set-variable = innodb_log_file_size=5M
#set-variable = innodb_log_buffer_size=8M
#innodb_flush_log_at_trx_commit=1
#innodb_log_archive=0
#set-variable = innodb_buffer_pool_size=16M
#set-variable = innodb_additional_mem_pool_size=2M
#set-variable = innodb_file_io_threads=4
#set-variable = innodb_lock_wait_timeout=50

[mysqldump]
quick
set-variable = max_allowed_packet=16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
set-variable = key_buffer=20M
se
t-variable = sort_buffer=20M
set-variable = read_buffer=2M
set-variable = write_buffer=2M

[myisamchk]
set-variable = key_buffer=20M
set-variable = sort_buffer=20M
set-variable = read_buffer=2M
set-variable = write_buffer=2M

[mysqlhotcopy]
interactive-timeout


if you do not have this file you can copy and paste this one.

well I suggest you check for this first then we can move on in this process. Other wise this would be a lengthy post.
 
Old 09-24-2002, 12:28 PM   #11
hanzerik
Member
 
Registered: Jan 2002
Location: Cheyenne Wyoming
Distribution: Debian/Raspbian/Mint
Posts: 717

Rep: Reputation: 32
have you tried just getting in by typing: myslq at the commandline?
 
Old 09-26-2002, 06:36 PM   #12
Staz
LQ Newbie
 
Registered: Aug 2002
Distribution: Red Hat 7.3 (Console Only)
Posts: 13

Original Poster
Rep: Reputation: 0
Problem Solved...

For whatever reason MySQL wasn't starting on boot, I had to manually go in and start safe_mysqld.

Thanks for all of your help!
 
Old 09-27-2002, 01:48 AM   #13
ToeShot
Member
 
Registered: Nov 2001
Location: Near Chicago
Distribution: FC5, Solaris 10, WinXP
Posts: 152

Rep: Reputation: 30
you can add this to your /etc/rc.local

/bin/sh -c `cd /usr/local/mysql; ./bin/mysql/mysqld_safe --user=mysql &`

make sure that you use your path to the location of your Mysql after the cd in the command above. Also depending on what version you have of Mysql determines how you start your daemon.

for example I have mysql 4.0 I need to start it like this

./bin/mysql/mysqld_safe --user=mysql

in older versions it is actually

./bin/mysql/safe_mysqld --user=mysql

but I don't remeber on which version it changed.
 
Old 09-27-2002, 06:36 AM   #14
hanzerik
Member
 
Registered: Jan 2002
Location: Cheyenne Wyoming
Distribution: Debian/Raspbian/Mint
Posts: 717

Rep: Reputation: 32
Or you can use ntsysv to select msqld to start on boot.
 
  


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
Buzilla issue: "Can't connect to local MySQL server through socket '/tmp/mysql.sock'" vitopn Linux - General 3 05-21-2007 10:13 AM
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 - Software

All times are GMT -5. The time now is 03:09 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