红联Linux门户
Linux帮助

linux中安装mysql的问题

发布时间:2009-12-26 05:59:05来源:红联作者:chen163
[root@localhost mysql-4.0.25]# chown -R root /usr/local/mysql
[root@localhost mysql-4.0.25]# chown -R mysql /usr/local/mysql/var
chown: 无法取得 ‘/usr/local/mysql/var’ 的属性: 没有那个文件或目录
如果在解压数据包前,先建组和用户就出现var目录,但没有在解压前建组和用户,解压时也自动创建,当没有在制定路径的目录下没有var。请问,这个怎么解决??
文章评论

共有 3 条评论

  1. liu_zhan 于 2010-12-21 21:09:22发表:

    [root@rhl9 mysql-3.22.30]# make
    make all-recursive
    make[1]: Entering directory `/opt/software/mysql-3.22.30'
    Making all in include
    make[2]: Entering directory `/opt/software/mysql-3.22.30/include'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/opt/software/mysql-3.22.30/include'
    Making all in Docs
    make[2]: Entering directory `/opt/software/mysql-3.22.30/Docs'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/opt/software/mysql-3.22.30/Docs'
    Making all in readline
    make[2]: Entering directory `/opt/software/mysql-3.22.30/readline'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/opt/software/mysql-3.22.30/readline'
    Making all in client
    make[2]: Entering directory `/opt/software/mysql-3.22.30/client'
    c++ -DUNDEF_THREADS_HACK -I./../include -I../include -I./.. -I.. -I.. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O3 -DDBUG_OFF -fno-implicit-templates -D_FILE_OFFSET_BITS=64 -c mysql.cc
    In file included from ../include/m_string.h:15,
    from mysql.cc:16:
    /usr/include/string.h:208: declaration of `char* strcasestr(const char*, const
    char*) throw ()' throws different exceptions
    ../include/my_sys.h:392: than previous declaration `char* strcasestr(const
    char*, const char*)'
    make[2]: *** [mysql.o] Error 1
    make[2]: Leaving directory `/opt/software/mysql-3.22.30/client'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/opt/software/mysql-3.22.30'
    make: *** [all-recursive-am] Error 2
    [root@rhl9 mysql-3.22.30]# make
    make all-recursive
    make[1]: Entering directory `/opt/software/mysql-3.22.30'
    Making all in include
    make[2]: Entering directory `/opt/software/mysql-3.22.30/include'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/opt/software/mysql-3.22.30/include'
    Making all in Docs
    make[2]: Entering directory `/opt/software/mysql-3.22.30/Docs'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/opt/software/mysql-3.22.30/Docs'
    Making all in readline
    make[2]: Entering directory `/opt/software/mysql-3.22.30/readline'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/opt/software/mysql-3.22.30/readline'
    Making all in client
    make[2]: Entering directory `/opt/software/mysql-3.22.30/client'
    c++ -DUNDEF_THREADS_HACK -I./../include -I../include -I./.. -I.. -I.. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O3 -DDBUG_OFF -fno-implicit-templates -D_FILE_OFFSET_BITS=64 -c mysql.cc
    In file included from ../include/m_string.h:15,
    from mysql.cc:16:
    /usr/include/string.h:208: declaration of `char* strcasestr(const char*, const
    char*) throw ()' throws different exceptions
    ../include/my_sys.h:392: than previous declaration `char* strcasestr(const
    char*, const char*)'
    make[2]: *** [mysql.o] Error 1
    make[2]: Leaving directory `/opt/software/mysql-3.22.30/client'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/opt/software/mysql-3.22.30'
    make: *** [all-recursive-am] Error 2
    [root@rhl9 mysql-3.22.30]# make

  2. chen163 于 2009-12-26 16:21:42发表:

    对呀
    我解压到指定目录/usr/local/mysql
    [root @ localhost mysql-4.0.25]#./configure --prefix=/usr/local/mysql
    执行上面脚本出现下面结果。当重新编译/usr/local/mysql/var出现了,安装成功了,能否解释一下这个脚本的意思?
    [root@localhost mysql-4.0.25]# ./test
    Removing old packages...
    Installing dependencies...
    Compiling and installing MySQL-4.0.25, this may take about 20 minutes, please wait...
    groupadd: group mysql exists
    useradd: user mysql exists
    tar (child): mysql-4.0.25.tar.gz: Cannot open: 没有那个文件或目录
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error exit delayed from previous errors
    ./test: line 15: cd: mysql-4.0.25: 没有那个文件或目录


    chown: 无法取得 ‘/mysql’ 的属性: 没有那个文件或目录
    chown: 无法取得 ‘/mysql’ 的属性: 没有那个文件或目录
    chown: 无法取得 ‘/mysql/var’ 的属性: 没有那个文件或目录
    MySQL Successfully Installed' || echo 'MySQL Installation Failed

  3. bobo504 于 2009-12-26 09:45:36发表:

    [i=s] 本帖最后由 bobo504 于 2009-12-26 11:58 编辑 [/i]

    你的意思是直接把下载的source解压到了/usr/local/mysql???
    随便解压到哪里,安装后才会生成这些目录
    我写了个简单的安装脚本,你可以根据你的mysql版本号替换掉我这里的MYSQL_VER变量值,然后试着安装一次[code]#!/bin/bash

    INSTALL_ROOT="/usr/local"
    MYSQL_VER="5.0.45"
    MYSQL_DIR="$INSTALL_ROOT/mysql"

    echo "Removing old packages..."
    rpm -e "rpm -qa | grep -i mysql" &> /dev/null

    echo "Installing dependencies..."
    yum install -y gcc gcc-c++ zlib zlib-devel libtermcap libtermcap-devel libtool &> /dev/null

    echo "Compiling and installing MySQL-$MYSQL_VER, this may take about 20 minutes, please wait..."
    groupadd mysql
    useradd -g mysql mysql
    tar zxf mysql-$MYSQL_VER.tar.gz
    cd mysql-$MYSQL_VER
    autoreconf --force --install &> /dev/null
    aclocal &> /dev/null
    autoheader &> /dev/null
    libtoolize --automake --force &> /dev/null
    automake --force --add-missing &> /dev/null
    autoconf &> /dev/null
    ./configure \
    --prefix=$MYSQL_DIR \
    --with-charset=gbk \
    --with-extra-charsets=all \
    --enable-assembler \
    --with-client-ldflags=-all-static \
    --with-mysqld-ldflags=-all-static \
    --enable-thread-safe-client \
    --with-big-tables \
    --with-unix-socket-path=$MYSQL_DIR/tmp/mysql.sock \
    --without-debug &> /dev/null
    make &> /dev/null && make install &> /dev/null
    #Create configuration file
    cp support-files/my-medium.cnf /etc/my.cnf
    #Create startup script and setup mysqld auto startup
    cp support-files/mysql.server /etc/init.d/mysqld
    chmod +x /etc/init.d/mysqld
    chkconfig mysqld on
    #Setup mysql-directory's permission for user mysql
    chown -R mysql.mysql $MYSQL_DIR
    $MYSQL_DIR/bin/mysql_install_db --user=mysql &> /dev/null
    chown -R root $MYSQL_DIR
    chown -R mysql $MYSQL_DIR/var
    #Create soft links for mysql binaries
    ln -s $MYSQL_DIR/bin/* /usr/bin/
    cd ..
    rm -rf mysql-$MYSQL_VER
    /etc/init.d/mysqld start &> /dev/null && echo "MySQL Successfully Installed' || echo 'MySQL Installation Failed"[/code]