MySQL нужна помощь по установке

Ответить
Аватара пользователя
Guest

MySQL нужна помощь по установке

Сообщение Guest »

скачал mysql-standard-4.0.21-pc-linux-i686.tar.gz

установил все как по инструкции, начал запускать

./bin/mysqld_safe &  - ругается

хочет писать в каталог /root/tmp/  я так понимаю должен наверное в /tmp



041027 18:34:25  mysqld started

/usr/local/mysql/bin/mysqld: Can't read dir of '/root/tmp/' (Errcode: 13)

/usr/local/mysql/bin/mysqld: Can't create/write to file '/root/tmp/ibD4eguh' (Errcode: 13)

041027 18:34:25  InnoDB: Error: unable to create temporary file; errno: 13

041027 18:34:25 Can't init databases

041027 18:34:25 Aborting



Подскажите как лечить
Аватара пользователя
archy

Re: MySQL нужна помощь по установке

Сообщение archy »

Плохо следовал инструкциям... а зачем его из под рута запускать? Что за дистр?
Аватара пользователя
archy

Re: MySQL нужна помощь по установке

Сообщение archy »

По идее, запуск дожен осуществлятся скриптом из /etc/init.d:



Код:

Код: Выделить всё

 
#!/bin/sh 
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB 
# This file is public domain and comes with NO WARRANTY of any kind 
# MySQL daemon start/stop script. 
# Usually this is put in /etc/init.d (at least on machines SYSV R4 based 
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql. 
# When this is done the mysql server will be started when the machine is 
# started and shut down when the systems goes down. 
# Comments to support chkconfig on RedHat Linux 
# chkconfig: 2345 90 20 
# description: A very fast and reliable SQL database engine. 
# Comments to support LSB init script conventions 
### BEGIN INIT INFO 
# Provides: mysql 
# Required-Start: $local_fs $network $remote_fs 
# Required-Stop: $local_fs $network $remote_fs 
# Default-Start:  2 3 4 5 
# Default-Stop: 0 1 6 
# Short-Description: start and stop MySQL 
# Description: MySQL is a very fast and reliable SQL database engine. 
### END INIT INFO 
# If you install MySQL on some other places than /, then you 
# have to do one of the following things for this script to work: 
# 
# - Run this script from within the MySQL installation directory 
# - Create a /etc/my.cnf file with the following information: 
#   [mysqld] 
#   basedir= 
# - Add the above to any other configuration file (for example ~/.my.ini) 
#   and copy my_print_defaults to /usr/bin 
# - Add the path to the mysql-installation-directory to the basedir variable 
#   below. 
# 
# If you want to affect other MySQL variables, you should make your changes 
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files. 
basedir= 
# The following variables are only set for letting mysql.server find things. 
# cbelisle@mandrakesoft : We need it to get the functions. 
INITD=/etc/rc.d/init.d 
. $INITD/functions 
# Set some defaults 
datadir=/var/lib/mysql 
pid_file= 
if test -z "$basedir" 
then 
  basedir=/ 
  bindir=/usr/bin 
else 
  bindir="$basedir/bin" 
fi 
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin 
export PATH 
if test -z "$pid_file" 
then 
  pid_file=$datadir/`/bin/hostname`.pid 
else 
  case "$pid_file" in 
    /* ) ;; 
    * )  pid_file="$datadir/$pid_file" ;; 
  esac 
fi 
mode=$1    # start or stop 
parse_arguments() { 
  for arg do 
    case "$arg" in 
      --basedir=*)  basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; 
      --datadir=*)  datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; 
      --pid-file=*) pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; 
    esac 
  done 
} 
# Get arguments from the my.cnf file, 
# groups [mysqld] [mysql_server] and [mysql.server] 
if test -x ./bin/my_print_defaults 
then 
  print_defaults="./bin/my_print_defaults" 
elif test -x $bindir/my_print_defaults 
then 
  print_defaults="$bindir/my_print_defaults" 
elif test -x $bindir/mysql_print_defaults 
then 
  print_defaults="$bindir/mysql_print_defaults" 
else 
  # Try to find basedir in /etc/my.cnf 
  conf=/etc/my.cnf 
  print_defaults= 
  if test -r $conf 
  then 
    subpat='^[^=]*basedir[^=]*=\(.*\)$' 
    dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf` 
    for d in $dirs 
    do 
      d=`echo $d | sed -e 's/[ 	]//g'` 
      if test -x "$d/bin/my_print_defaults" 
      then 
        print_defaults="$d/bin/my_print_defaults" 
        break 
      fi 
      if test -x "$d/bin/mysql_print_defaults" 
      then 
        print_defaults="$d/bin/mysql_print_defaults" 
        break 
      fi 
    done 
  fi 
  # Hope it's in the PATH ... but I doubt it 
  test -z "$print_defaults" && print_defaults="my_print_defaults" 
fi 
# 
# Test if someone changed datadir;  In this case we should also read the 
# default arguments from this directory 
# 
extra_args="" 
if test "$datadir" != "/var/lib/mysql" 
then 
  extra_args="-e $datadir/my.cnf" 
fi 
parse_arguments `$print_defaults $extra_args mysqld mysql_server mysql.server` 
# Safeguard (relative paths, core dumps..) 
cd $basedir 
case "$mode" in 
  'start') 
    # Start daemon 
    TMPDIR=/tmp 
    export TMPDIR 
    TMP=/tmp 
    export TMP 
    if test -x $bindir/mysqld_safe 
    then 
      # Give extra arguments to mysqld with the my.cnf file. This script may 
      # be overwritten at next upgrade. 
      gprintf "Starting MySQL Server"       
      $bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file 2>&1 | logger -t mysqld_safe & 
      success 
      # Make lock for RedHat / SuSE 
      if test -w /var/lock/subsys 
      then 
        touch /var/lock/subsys/mysql 
      fi 
      echo 
    else 
      gprintf "Can't execute %s/mysqld_safe from dir %s\n" "$bindir" "$basedir" 
    fi 
    ;; 
  'stop') 
    # Stop daemon. We use a signal here to avoid having to know the 
    # root password. 
    unset TMPDIR 
    unset TMP 
    gprintf "Stopping MySQL Server\n"     
    if test -s "$pid_file" 
    then 
      mysqld_pid=`cat $pid_file` 
      kill $mysqld_pid 
      gprintf "(pid %s)" "$mysqld_pid" 
      # mysqld should remove the pid_file when it exits, so wait for it. 
      sleep 1 
      while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ] 
      do 
        [ -z "$flags" ] && echo "Wait for mysqld to exit\c" || echo ".\c" 
        flags=a$flags 
        sleep 1 
      done 
      if [ -s $pid_file ] 
          then failure " gave up waiting!" 
      elif [ -n "$flags" ] 
          then success 
      else 
          success 
      fi 
      # delete lock for RedHat / SuSE 
      if test -f /var/lock/subsys/mysql 
      then 
        rm /var/lock/subsys/mysql 
      fi 
      echo   
    else 
      failure "No mysqld pid file found. Looked for %s." "$pid_file" 
      echo 
    fi 
    ;; 
     
   'status') 
     status mysqld 
     ;; 
     
   'reload') 
     $0 stop 
     $0 start 
     ;; 
   
  'restart') 
    # Stop the service and regardless of whether it was 
    # running or not, start it again. 
    $0 stop 
    $0 start 
    ;; 
  *) 
    # usage 
    gprintf "usage: %s {start|stop|status|reload|restart}\n" "$0" 
    exit 1 
    ;; 
esac

И запускать его следует из-под суперпользователя, причём, предварительно прочитав manual про конфигурационные файлы.Изображение
Аватара пользователя
archy

Re: MySQL нужна помощь по установке

Сообщение archy »

Netscaper

Все зависит от дистра! Зачем пускать mysql от root'a? Маразм IMNO! Не пудри человеку мозги!

PS:  А если уж пускать от рута то с понижением привелегий (--user=${mysqluser}).

А может все будем делать cat /etc/init.d/*, всем будет от этого легче?
Аватара пользователя
archy

Re: MySQL нужна помощь по установке

Сообщение archy »

Прошу прощения, про суперпользователя я ошибся маленько... Действительно, лучше создать пользователя/группу mysql/mysql и подправить конфиг, чтобы временные файлы хранил где-нибудь типа /tmp, а не /root/tmp.Изображение



Код:

Код: Выделить всё

 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file
=/var/lib/mysql/WARUM-DEV-SERVER.pid --skip-locking

[s]Исправлено: Netscaper, 12:12 28-10-2004[/s]
Аватара пользователя
Michelleq3

Re: MySQL нужна помощь по установке

Сообщение Michelleq3 »

люди, а как это лечить?




Цитата:



041030 21:53:02  mysqld started

041030 21:53:07  InnoDB: Started

041030 21:53:08  Fatal error: Can't open privilege tables: Can't find file: './mysql/host.frm' (errno: 13)

041030 21:53:08  Aborting



041030 21:53:08  InnoDB: Starting shutdown...

041030 21:53:10  InnoDB: Shutdown completed

041030 21:53:10  /usr/libexec/mysqld: Shutdown Complete



041030 21:53:10  mysqld ended



хотя /var/lib/mysql/mysql/host.frm существует.
Аватара пользователя
archy

Re: MySQL нужна помощь по установке

Сообщение archy »

Michelleq3

Где то не там он ищет этот файл...
Аватара пользователя
archy

Re: MySQL нужна помощь по установке

Сообщение archy »

перед тем как запускать export TMPDIR=/tmp или ещё куда нить
Аватара пользователя
Micx

Re: MySQL нужна помощь по установке

Сообщение Micx »

После установки RPM пакета, надо

1. Cоздать пользователя mysql, если его нет. $HOME должна быть указана в директорию base, у меня это /var/lib/mysql(chown mysql:mysql, chmod 755)

2. Создать файл конфигурации(my.cnf) - Надо смотреть в mysql.server откуда он его берет.

/etc/my.cnf

#--------------------------------

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

default-character-set=cp1251

set-variable = lower_case_table_names=1

[mysql.server]

user=mysql

basedir=/var/lib



[safe_mysqld]

err-log=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

#-------------------------------------------------

3. Запустить mysql_install_db под пользователем mysql

#su mysql mysql_install_db



После этого можно запускать сервер

Остальное читай в манах
Ответить

Вернуться в «Программное обеспечение Linux и FreeBSD»