MySQL.sock permissions

1. Install


#portsnam fetch extract update...
#cd /usr/ports/database/mysql**-server/ <-- I checked the all
versions.
#make install clean....


2. Running.

#cd /usr/local/etc/rc.d/
#./mysql-server.sh
Code:
Starting mysql.
#./mysql-server.sh stop
Code:
mysql not running? (check /var/db/mysql//domena.pid).
[/CODE]

3. Permissions
Kod:

# ls -ld /var/db/mysql
Code:
drwxrwxrwx  5 mysql  mysql  512 Nov 30 18:29 /var/db/mysql
#ls -ld /var/tmp
Code:
drwxr-xr-t  3 root  wheel  1024 Nov 30 18:25 /var/tmp
#ls -ld /tmp
Code:
drwxr-xr-t  9 root  wheel  1024 Nov 30 18:25 /tmp


4. Other

mysql_install_db (run root.)
Code:
Installing MySQL system tables...
OK
Filling help tables...
OK


# mysql_install_db --user=mysql --datadir=/var/db/mysql
Code:
Installing MySQL system tables...
ERROR: 1004  Can't create file '/var/tmp/#sql786_1_0.frm' (errno: 13)
101130 19:31:50 [ERROR] Aborting

101130 19:31:50 [Note] /usr/local/libexec/mysqld: Shutdown complete

Installation of system tables failed!

Examine the logs in /var/db/mysql for more information.



Code:
#mysql_upgrade
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck'...
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through 
socket '/tmp/mysql.sock' (2) when trying to connect
FATAL ERROR: Upgrade failed

Code:
#mysqld_safe
Starting mysqld daemon with databases from /var/db/mysql
STOPPING server from pid file /var/db/mysql/domena.pid
101130 18:48:13  mysqld ended

Code:
#cd /var/db/mysql
pic domena.pl.err
mysqld started
/usr/local/libexec/mysqld: Can't create/write to file '/var/tmp/ibb83jeL' (Errcode: 13)
101130 18:48:12  InnoDB: Error: unable to create temporary file; errno: 13
101130 18:48:12 [ERROR] bdb:  /var/db/mysql: Permission denied
101130 18:48:12 [ERROR] bdb:  /var/db/mysql/log.0000000001: Permission denied
101130 18:48:12 [ERROR] bdb:  PANIC: Permission denied
101130 18:48:12 [ERROR] bdb:  PANIC: DB_RUNRECOVERY: Fatal error, run database recovery
101130 18:48:12 [ERROR] bdb:  fatal region error detected; run recovery
101130 18:48:12 [ERROR] bdb:  /var/db/mysql: Permission denied
101130 18:48:13 [ERROR] Can't start server : Bind on unix socket: Permission denied
101130 18:48:13 [ERROR] Do you already have another mysqld server
 running on socket: /tmp/mysql.sock ?
101130 18:48:13 [ERROR] Aborting

101130 18:48:13 [Note] /usr/local/libexec/mysqld: Shutdown complete

101130 18:48:13  mysqld ended

Code:
# ls -ld /var/db/mysql
drwx------  4 mysql  88  512 Nov 30 20:49 /var/db/mysql


Please help...
 
Code:
find /var/db/mysql -type d | xargs chmod 700
find /var/db/mysql -type f | xargs chmod 660
It doesn't work..
 
# chown -R mysql:mysql /var/db/mysql
# chmod u+rwx,go= /var/db/mysql

Code:
# mysql_install_db --user=mysql
Installing MySQL system tables...
ERROR: 1  Can't create/write to file '/var/db/mysql/mysql/db.MYI' (Errcode: 13)
101201  8:46:43 [ERROR] Aborting

101201  8:46:43 [Note] /usr/local/libexec/mysqld: Shutdown complete


Installation of system tables failed! Examine the logs in
/var/db/mysql for more information.



Code:
#cd /var/db/mysql <- for more information.
# ls
mysql   test
# cd mysql/
# ls
# cd ..
# cd test/
# ls

???:(
 
Is MySQL actually running? You need a running MySQL before you can do mysql_install_db. If I recall correctly you don't even need to do that. It'll be done automatically when MySQL starts for the first time.
 
Code:
# ls -ld /var/db/mysql
drwx------  4 mysql  wheel  512 Dec  1 08:46 /var/db/mysql


Code:
#mysqld_safe
101201 08:58:37 mysqld_safe Logging to '/var/db/mysql/hq.hostname.err'.
101201 08:58:37 mysqld_safe Starting mysqld daemon with databases from 
/var/db/mysql
101201 08:58:38 mysqld_safe mysqld from pid file /var/db/mysql/hq.hostname.pid
 ended
[root@hq /usr/local/etc/rc.d]# pic /var/db/mysql/hq.hostname.err
.lf 1 /var/db/mysql/hq.hostname.err
101201 08:58:37 mysqld_safe Starting mysqld daemon with databases from 
/var/db/mysql
101201  8:58:37 [Note] [color="red"]Plugin 'FEDERATED' is disabled.
/usr/local/libexec/mysqld: Table 'mysql.plugin' doesn't exist
101201  8:58:37 [ERROR] Can't open the mysql.plugin table. Please run 
mysql_upgrade to create it.[/color]
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
/usr/local/libexec/mysqld: [color="Red"]Can't create/write to file 
'/var/tmp/ibLyEDUG'[/color] (Errcode: 13)
101201  8:58:38  InnoDB: Error: unable to create temporary file; errno: 9
101201  8:58:38 [ERROR] Plugin 'InnoDB' init function returned error.
101201  8:58:38 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE 
failed.
101201  8:58:38 [ERROR] Unknown/unsupported storage engine: InnoDB
101201  8:58:38 [ERROR] Aborting

101201  8:58:38 [Note] /usr/local/libexec/mysqld: Shutdown complete

101201 08:58:38 mysqld_safe mysqld from pid file /var/db/mysql/hq.hostname.pid
 ended

Code:
# ls -ld /var/tmp/
drwxr-xr-t  4 root  wheel  1024 Dec  1 08:56 /var/tmp/
ls -la /var/tmp/
total 8
drwxr-xr-t   4 root   wheel  1024 Dec  1 08:56 .
drwxr-x---  31 root   wheel  1024 Nov 26 11:07 ..
drwxr-xr-t   3 mysql  wheel   512 Nov 30 05:49 temproot
drwxr-xr-t   2 mysql  wheel   512 Nov 30 18:54 vi.recover
Code:
# mysql_upgrade
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck with default connection arguments
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through 
socket '/tmp/mysql.sock' (2) when trying to connect
FATAL ERROR: Upgrade failed
Code:
# ls -la /tmp
total 386
drwxr-xr-t  10 root   wheel    1024 Dec  1 05:30 .
drwxr-xr-x  26 root   wheel    1024 Nov 24 02:08 ..
drwx------   2 root   wheel     512 Nov 25 09:46 .ICE-unix
drwx------   2 root   wheel     512 Nov 25 09:46 .X11-unix
drwx------   2 root   wheel     512 Nov 25 09:46 .XIM-unix
drwx------   2 root   wheel     512 Nov 25 09:46 .font-unix
-rwxr-xr-t   1 root   wheel    1433 Nov 26 00:09 3strikes.db
-rwxr-xr-t   1 root   wheel      53 Nov 26 00:09 commandLine.db
-rwxr-xr-t   1 root   wheel      37 Nov 26 00:09 configure.db
--cat---

Code:
ls -ld /tmp/
drwxr-xr-t  10 root  wheel  1024 Dec  1 05:30 /tmp/
 
SirDice said:
Is MySQL actually running? You need a running MySQL before you can do mysql_install_db. If I recall correctly you don't even need to do that. It'll be done automatically when MySQL starts for the first time.

# ps axww | grep mysql

Nothing any processes... I can not run MySQL...
 
Start it the regular way:
# /usr/local/etc/rc.d/mysql-server start
 
SirDice said:
Start it the regular way:
# /usr/local/etc/rc.d/mysql-server start

Code:
# ./mysql-server start
Starting mysql.
# ./mysql-server status
mysql is not running.


rc.conf add
Code:
enable_mysql="YES"
and: /usr/local/etc/rc.d/mysql-server

Code:
: ${mysql_enable="YES"}
: ${mysql_limits="NO"}
: ${mysql_dbdir="/var/db/mysql"}
: ${mysql_args=""}
 
Ok. Now check /var/log/messages and/or /var/db/mysql/`hostname`.err.
 
SirDice said:
Ok. Now check /var/log/messages and/or /var/db/mysql/`hostname`.err.

Code:
#[FILE]tail -f /var/log/messages[/FILE]
Dec  1 08:28:40 hq inetd[1624]: ftp/tcp: bind: Address already in use
Dec  1 08:38:39 hq inetd[1624]: ftp/tcp: bind: Address already in use
Dec  1 08:43:55 hq syslogd: Logging subprocess 31390 (exec    
          /usr/local/sbin/sshit) exited with status 2.
Dec  1 08:44:02 hq syslogd: Logging subprocess 31396 (exec    
          /usr/local/sbin/sshit) exited with status 2.
Dec  1 08:44:06 hq su: manti to root on /dev/pts/0
Dec  1 08:44:06 hq syslogd: Logging subprocess 31401 (exec    
          /usr/local/sbin/sshit) exited with status 2.
Dec  1 08:48:39 hq inetd[1624]: ftp/tcp: bind: Address already in use
Dec  1 08:58:39 hq inetd[1624]: ftp/tcp: bind: Address already in use
Dec  1 09:08:39 hq inetd[1624]: ftp/tcp: bind: Address already in use
Dec  1 09:18:39 hq inetd[1624]: ftp/tcp: bind: Address already in use
I changed the configuration of inetd.conf...

Code:
# cd /var/db/mysql/
# [FILE]pic hq.hostname.err[/FILE]
.lf 1 hq.hostname.err
101201 08:58:37 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
101201  8:58:37 [Note] [color="Red"]Plugin 'FEDERATED' is disabled.[/color]
/usr/local/libexec/mysqld: Table 'mysql.plugin' doesn't exist
101201  8:58:37 [ERROR] Can't open the mysql.plugin table. Please run 
mysql_upgrade to create it.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
/usr/local/libexec/mysqld: [color="red"]Can't create/write to file 
'/var/tmp/ibLyEDUG' (Errcode: 13)[/color]
101201  8:58:38  InnoDB: Error: unable to create temporary file; errno: 9
101201  8:58:38 [ERROR] Plugin 'InnoDB' init function returned error.
101201  8:58:38 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
101201  8:58:38 [ERROR] Unknown/unsupported storage engine: InnoDB
101201  8:58:38 [ERROR] Aborting

101201  8:58:38 [Note] /usr/local/libexec/mysqld: Shutdown complete

101201 08:58:38 mysqld_safe mysqld from pid file /var/db/mysql/hq.hostname.pid
 ended
 
SirDice said:
What are the permissions on /var/tmp/?

Code:
#[CMD=" "]ls -ld /var/tmp[/CMD]
drwx-----T  4 root  wheel  1024 Dec  1 09:45 /var/tmp

Code:
#[CMD=" "]ls -la /var/tmp/[/CMD]
total 8
drwx-----T   4 root   wheel  1024 Dec  1 09:45 .
drwxr-x---  31 root   wheel  1024 Nov 26 11:07 ..
drwxr-xr-t   3 mysql  wheel   512 Nov 30 05:49 temproot
drwxr-xr-t   2 mysql  wheel   512 Nov 30 18:54 vi.recover
 
manti said:
Code:
#ls -ld /var/tmp
drwx-----T  4 root  wheel  1024 Dec  1 09:45 /var/tmp
Those are not correct and it's probably the cause why MySQL refuses to start. They should be 1777:
Code:
root@molly:~#ls -ld /var/tmp/
drwxrwxrwt  3 root  wheel  512 Nov 25 23:03 /var/tmp/
 
SirDice said:
Those are not correct and it's probably the cause why MySQL refuses to start. They should be 1777:
Code:
root@molly:~#ls -ld /var/tmp/
drwxrwxrwt  3 root  wheel  512 Nov 25 23:03 /var/tmp/

Reinstall MySQL55...


[root@hq /usr/local/etc/rc.d]# chmod 1777 /var/tmp
[root@hq /usr/local/etc/rc.d]# ls -ld /var/tmp
Code:
drwxrwxrwt  4 root  wheel  1024 Dec  1 18:15 /var/tmp[/CMD]
[root@hq /usr/local/etc/rc.d]# ./mysql-server start
Code:
Starting mysql.
[root@hq /usr/local/etc/rc.d]# ./mysql-server status
Code:
mysql is not running.
[root@hq /usr/local/etc/rc.d]# ps axww | grep mysql
Code:
13252   0  S+     0:00.02 grep mysql
34962   0  TW     0:00.00 /bin/sh -ec for file in mysql-5.5.7-rc.tar.gz; do 
 if ! (cd /usr/ports/databases/mysql55-server/work && /usr/bin/gzip -nf -9 -dc 
/usr/ports/distfiles//$file | /usr/bin/tar -xf - --no-same-owner --no-same-
permissions); then  exit 1;  fi;  done
34963   0  TW     0:00.00 /bin/sh -ec for file in mysql-5.5.7-rc.tar.gz; do  
if ! (cd /usr/ports/databases/mysql55-server/work && /usr/bin/gzip -nf -9 -dc 
/usr/ports/distfiles//$file | /usr/bin/tar -xf - --no-same-owner --no-same-
permissions); then  exit 1;  fi;  done
34964   0  TW     0:00.00 /usr/bin/gzip -nf -9 -dc 
/usr/ports/distfiles//mysql-5.5.7-rc.tar.gz
[root@hq /usr/local/etc/rc.d]#
 
# pic /var/db/mysql/hq.hostname.err
Code:
/usr/local/libexec/mysqld: Can't create/write to file '/var/tmp/ibdIYhrC' (Errcode: 13)
This command fixed the run mysql.

# chmod 1777 /var

ps axww | grep mysql

Code:
51192   3  T      0:00.11 /bin/sh /usr/local/bin/mysqld_safe --user=mysql -
-log
51265   3  T      0:01.21 /usr/local/libexec/mysqld --basedir=/usr/local --
datadir=/var/db/mysql --plugin-dir=/usr/local/lib/mysql/plugin --user=mysql --log 
--log-error=/var/db/mysql/hq.hostname.err --pid-
file=/var/db/mysql/hq.hostname.pid
51343   3  R+     0:00.01 grep mysql

Thanks for help!
 
SirDice said:
Revert that asap. The correct permissions on /var/ are 755.


Ok, thans SirDice. I can still run MySQL...

#./mysql-server stop
Code:
Stopping mysql.
#chmod 1755 /var
#./mysql-server start
Code:
Starting mysql.
# ps axww |grep my
Code:
46461  ??  Ss     0:00.11 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-
file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-
file=/var/db/mysql/hq.hostname.pid
46541  ??  S      0:01.11 /usr/local/libexec/mysqld --defaults-extra-
file=/var/db/mysql/my.cnf --basedir=/usr/local --datadir=/var/db/mysql --plugin-
dir=/usr/local/lib/mysql/plugin --log-error=/var/db/mysql/hq.hostname.err --pid-
file=/var/db/mysql/hq.hostname.pid
 
Sigh:

[cmd=]chmod 755 /var[/cmd]
[cmd=]chmod -R 1777 /var/tmp[/cmd]
 
DutchDaemon said:
Sigh:

[cmd=]chmod 755 /var[/cmd]
[cmd=]chmod -R 1777 /var/tmp[/cmd]

# chmod -R 1777 /var/tmp
Code:
chmod: /var/tmp/temproot/var/empty: Operation not permitted

But I can still run MySQL.
 
Just to make sure:

[cmd=]ls -ld /var[/cmd] should give
Code:
drwxr-xr-x
[cmd=]ls -ld /var/tmp[/cmd] should give
Code:
drwxrwxrwt
 
Back
Top