The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - General (http://hintsforums.macworld.com/forumdisplay.php?f=16)
-   -   Database Problems (http://hintsforums.macworld.com/showthread.php?t=46929)

lolajl 11-03-2005 01:48 PM

Database Problems
 
I'm having a problem with the MySQL and PosgreSQL database servers on this laptop (10.4.2). I cannot get these back up and running for some reason and I'm getting desperate as I have been uable to figure out what's the problem, or to locate anyone in this area who can take a look at my setup. Here's the problem I'm having:

I've been having problems getting Mysql and Postresql running on this laptop - for Mysql it's 4.1.11 from Mysql.com and for Postgresql it is 8.01, I think, from http://pgsqlformac.sourceforge.net/. I have both of these set to startup automatically upon boot.

For both applications, here's what happens when I try to access these databases:

For MySQL, I'm using MySQL 4.1.11 (mysql-standard-4.1.11-apple-darwin7.8.0-powerpc). I have a prefpane for MySQL in System Preferences, but I cannot access. Also, I have both MySQL and Postgresql set to start up on bootup.

Somehow, this crucial file has inexplicably been wiped out, so that when I type in mysql in terminal, I get this:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

And when I try to fire up phpMyAdmin, I get this:

MySQL said:

#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)

For Postgresql, here's what I have:

[07:21 PM] ~ 2 $ psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Looking in /tmp, I don't see mysql.sock or .s.pgsql.5432.

I've tried running the command within terminal to force shutdown/startup, with no luck:

sudo ./mysqld_safe --user=mysqluser &
[5] 1348
[4] Exit 1 ./mysqld_safe --user=mysqluser

When I look in mysql directory, I see that the owner for all the directories/files except for data is set to root; data is set to mysql.

I've been told that it's a permission issue, but I can't see exactly what it is that I have to fix. I've got databases for both mysql and posgresql, so I don't want to just wipe out the installations and start afresh.

It seems to be a permission problem but I cannot figure out exactly what it is.

I'm desperate to get these databases back up and running because I have databases that I want to save.

lolajl 11-03-2005 02:43 PM

Following up, here's what it says in the .err fie:

051103 14:32:01 mysqld started
051103 14:32:07 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data$
051103 14:32:11 [ERROR] Can't start server : Bind on unix socket: Permission denied
051103 14:32:11 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
051103 14:32:11 [ERROR] Aborting

051103 14:32:12 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

051103 14:32:13 mysqld ended


The last normal processs went like this:

051012 10:23:35 mysqld started
051012 10:23:57 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data$
051012 10:24:43 InnoDB: Started; log sequence number 0 47151
/usr/local/mysql/bin/mysqld: ready for connections.
Version: '4.1.11-standard' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Edition - Standard (G$
051012 19:21:55 [Note] /usr/local/mysql/bin/mysqld: Normal shutdown

hayne 11-03-2005 03:36 PM

Search these forums for: mysql
and see if any of the many existing threads have something that helps you.
For example, see this very recent thread:
http://forums.macosxhints.com/showthread.php?t=42373

lolajl 11-03-2005 05:00 PM

Still tearing my hair out over this. Changed permission for mysql to mysql:mysql. Checked permissions for /tmp (.sock does NOT exist there):

[04:49 PM] ~ 2 $ ls -ld /tmp
drwxr-xr-x 42 lolajl staff 1428 Nov 3 16:45 /tmp
[04:50 PM] ~ 3 $ ls -ld /private/tmp
drwxrwxrwt 2 root wheel 68 Nov 3 16:46 /private/tmp

Still won't start up, what I get is this when i start up as root:

Starting mysqld daemon with databases from /usr/local/mysql/data
STOPPING server from pid file /usr/local/mysql/data/tsarskoeselo.pid
051103 16:57:59 mysqld ended

Looking in .err:

051103 16:57:59 [ERROR] Can't start server : Bind on unix socket: Permission de$
051103 16:57:59 [ERROR] Do you already have another mysqld server running on so$
051103 16:57:59 [ERROR] Aborting

051103 16:57:59 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

051103 16:57:59 mysqld ended

What next? How do I check that port 3306 isn't blocked? I'm getting frustrated by this.

hayne 11-03-2005 05:32 PM

The only thing I can suggest is to google for:
"Can't start server : Bind on unix socket"
and look at what has been suggested by others who have dealt with this error.
I think I recall that there was some bug in the install scripts that got fixed in a recent version of mySQL 5 - so maybe it existed in version 4 as well. As I recall, it affected upgrades, not fresh installs.

lolajl 11-03-2005 10:47 PM

Okay . . . I found the page at mysql.com which I thought would resolve this problem, but I'm still getting the socket error. So, I had no choice but to remove /usr/local/mysql and reinstall. When I ran the 4.15 installer package, I got Upgrade instead of Install but thought nothing of it. Went ahead and still the same issue. So there seems to be other files other than /usr/local/mysql that I need to remove. What would these files be?

lolajl 11-03-2005 11:05 PM

On a hunch, I got rid of the 4.15 install, and went and installed mysql 5.0. I got the Install option, so went and installed it. Tried to start up mysql by doing this:

sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

What I got was:

Starting MySQL database server

Then, I typed ^Z and got "[1]+ Stopped sudo /Library/StartupItems/MySQLCOM/MySQLCOM start"

When I go into System Preferences and click on Mysql, I'm seeing that the server is stopped. when I try to start it up, I get the beach ball and nothing happens. When I try to type "mysql" in Terminal, I get:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Here's what the log is saying now:

051103 22:54:49 mysqld started
051103 22:54:49 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
051103 22:54:49 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
051103 22:54:50 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
051103 22:54:50 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
051103 22:54:51 InnoDB: Started; log sequence number 0 0
051103 22:54:51 [ERROR] Can't start server : Bind on unix socket: Permission denied
051103 22:54:51 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
051103 22:54:51 [ERROR] Aborting

051103 22:54:51 InnoDB: Starting shutdown...
051103 22:54:53 InnoDB: Shutdown completed; log sequence number 0 43655
051103 22:54:53 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

051103 22:54:53 mysqld ended

051103 22:56:43 mysqld started
051103 22:56:43 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
051103 22:56:43 InnoDB: Started; log sequence number 0 43655
051103 22:56:43 [ERROR] Can't start server : Bind on unix socket: Permission denied
051103 22:56:43 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
051103 22:56:43 [ERROR] Aborting

051103 22:56:43 InnoDB: Starting shutdown...
051103 22:56:46 InnoDB: Shutdown completed; log sequence number 0 43655
051103 22:56:46 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

051103 22:56:46 mysqld ended

051103 22:57:38 mysqld started
051103 22:57:38 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
051103 22:57:39 InnoDB: Started; log sequence number 0 43655
051103 22:57:39 [ERROR] Can't start server : Bind on unix socket: Permission denied
051103 22:57:39 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
051103 22:57:39 [ERROR] Aborting

051103 22:57:39 InnoDB: Starting shutdown...
051103 22:57:41 InnoDB: Shutdown completed; log sequence number 0 43655
051103 22:57:41 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

051103 22:57:41 mysqld ended


I'm getting beyond frustrated and feel like throwing this stupid laptop out the window.

lolajl 11-08-2005 08:41 AM

Well, I'm still no closer to solving this problem. Will reinstalling System 10.4.3 make this go away?

hayne 11-08-2005 08:47 AM

I doubt that it is necessary to reinstall OS X unless you have somehow damaged some of the system files in your attempts to install mySQL.

Instead, I think you should just remove all vestiges of your install attempts and then try again with a mySQL package version that others say they have succeeded with on your version of OS X, being extremely careful to follow the install instructions.

lolajl 11-08-2005 08:52 AM

That's what I did in #7. Is there a list of files that the installer places so I can make sure that every single file is deleted, other than /usr/local/mysql directory? There's got to be a file that somehow escaped my attention. I'm using the installers from mysql.com. Unfortunately, they don't have an uninstaller package for OSX, which would have helped me out a lot with this issue.

hayne 11-08-2005 09:05 AM

Perhaps the instructions on Marc Liyanage's page might help:
http://www.entropy.ch/software/macosx/mysql/

lolajl 11-08-2005 09:18 AM

Another thing . . . is there anything that keeps track of sockets - that's the main problem - there seems to be a open socket hole associated with mysql that just won't close down even though the mysql server seems not to be running?

hayne 11-08-2005 09:30 AM

Quote:

Originally Posted by lolajl
Another thing . . . is there anything that keeps track of sockets - that's the main problem - there seems to be a open socket hole associated with mysql that just won't close down even though the mysql server seems not to be running?

If you reboot, then all networking will be reinitialized.

lolajl 11-08-2005 09:37 AM

The laptop's been rebooted countless time . . . I've been dealing with this problem for the past 2 months.

schwartze 11-08-2005 09:57 AM

Did you try and follow the directions on the Mark Liyanage site above?

When I was having the problems i ran the remove script a couple of times.

If you are getting the upgrade, rather than the install there are still remnants around somewhere.

Now that you have installed 3 or so different versions you have to make sure they are all gone before installing clean.

Try a reboot after each removal.

lolajl 11-08-2005 10:05 AM

Yeah, I've got the remove scripts. I'll give this another go later today . . . I've got to go out for a moment.

lolajl 11-08-2005 03:21 PM

Okay . . . I ran the script (had to modify it to take out [34] since I got "no packages found" when I ran it the first time). It found one mysql package, I clicked yes to both questions. Then, I restarted, and here's what I got (just like before):

[03:00 PM] /usr/local/mysql 4 $ sudo ./bin/mysqld_safe
Password:
Starting mysqld daemon with databases from /usr/local/mysql/data
STOPPING server from pid file /usr/local/mysql/data/tsarskoeselo.pid
051108 15:00:57 mysqld ended

Looking in tsarskoeselo.err:

051108 15:00:56 mysqld started
051108 15:00:56 [Warning] Setting lower_case_table_names=2 because file system $
051108 15:00:57 [ERROR] Can't start server : Bind on unix socket: Permission de$
051108 15:00:57 [ERROR] Do you already have another mysqld server running on so$
051108 15:00:57 [ERROR] Aborting

051108 15:00:57 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

051108 15:00:57 mysqld ended


I installed the 4.1.5 package. Soooooo . . . it's back to square one - the same issue with the unix socket. Suggestions? Reinstall the OS and hope it fixes the problem?

schwartze 11-08-2005 04:01 PM

Have you gone back to Newbish's post in the thread above? Have you checked the permissions on the newly created directory and files?

I wish I remember what it was that fixed my problem when it occurred, but I don't and I left on vacation right after it was all good. I did lose a lot of hair over it though. That I remember.

lolajl 11-08-2005 04:18 PM

Oh, thanks for reminding me. I'm having exactly the same problem as yayel - fixed permission, checked permission for /private/tmp (exactly the same as hayne):

drwxrwxrwt 3 root wheel 102 Nov 8 14:59 /private/tmp

Ran this: mysqld_safe --user=mysql &

Am back to square one with the non-start of the mysqld daemon.

lolajl 11-08-2005 05:59 PM

Okay . . . I think I'm getting close to finally having this resolved. Someone saw my message in another forum, and helped me via ichat with this. Turns out to have been a permission problem on /tmp. Here's what it was initially:

drwxrwxrwx 32998 lolajl staff 1121932 Nov 8 17:22 .

Owner should be root:staff, with t at the end of the permission string. With /tmp set as such:

drwxrwxrwt 33063 root staff 1124142 Nov 8 17:29 .

Postgresql is now back up and running. I suspect the same will be true for mysql when I get this back up and running.

schwartze 11-08-2005 06:06 PM

My temp owner is root admin...

Code:

monkey:~ eric$ ls -ld /private/tmp
drwxrwxrwt  14 root  wheel  476 Nov  8 18:04 /private/tmp
monkey:~ eric$ ls -ld /tmp       
lrwxr-xr-x  1 root  admin  11 Apr 29  2005 /tmp -> private/tmp
monkey:~ eric$


hayne 11-08-2005 06:32 PM

Quote:

Originally Posted by lolajl
Turns out to have been a permission problem on /tmp.

I think it is more than a mere permission problem. Looking back at a previous post I see that you said:
Quote:

Originally Posted by lolaji in post#4
[04:49 PM] ~ 2 $ ls -ld /tmp
drwxr-xr-x 42 lolajl staff 1428 Nov 3 16:45 /tmp
[04:50 PM] ~ 3 $ ls -ld /private/tmp
drwxrwxrwt 2 root wheel 68 Nov 3 16:46 /private/tmp

I didn't notice at the time but the first result is not good.
As I pointed out much earlier (in the other thread that I referred to), the folder "/tmp" is supposed to be a symbolic link to "/private/tmp" - it isn't supposed to be an actual folder.
Thus the correct results should look like this:
Code:

% ls -ld /tmp
lrwxr-xr-x  1 root  admin  11 Apr 30  2005 /tmp -> private/tmp

% ls -ld /private/tmp
drwxrwxrwt  11 root  wheel  374 Nov  8 09:28 /private/tmp

If you have an actual folder at /tmp instead of the symbolic link to /private/tmp then you will need to remove this whole folder (with 'rm -rf') and then recreate the symbolic link (with 'ln -s')
See the detailed instructions in this old thread:
http://forums.macosxhints.com/showthread.php?t=22763

lolajl 11-08-2005 06:55 PM

As I suspected, the mysql problems are fixed as well.

lolajl 11-08-2005 06:58 PM

Quote:

Originally Posted by hayne
If you have an actual folder at /tmp instead of the symbolic link to /private/tmp then you will need to remove this whole folder (with 'rm -rf') and then recreate the symbolic link (with 'ln -s')
See the detailed instructions in this old thread:
http://forums.macosxhints.com/showthread.php?t=22763

Will do so . . . thanks!

lolajl 11-08-2005 07:05 PM

By the way, should I remove everything in /tmp before making the changes as outlined in the thread? Checked and am seeing "tmp -> /private/tmp" within /tmp which of course is not the correct location.

lolajl 11-08-2005 08:58 PM

Okay, fixed the link to /tmp and all is well and good now . . . thanks!


All times are GMT -5. The time now is 05:57 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.