• Install MySQL 5.0 Max on FC3



    Install MySQL 5.0 Max on FC3

    =============================
    Install MySQL 5.0 Max on FC3
    kowala 2005/03/04
    =============================

    mysql had been supported some functions as UNION, Transactions, Full-text indexing and searching, full Unicode, subqueries, Views, Stored procedures and triggers, etc... since v.4.0.
    see http://www.mysql.com/products/mysql/

    i try 2 way to install mysql here, they are rpm and tar.gz, but the way of rpm(MySQL-server-5.0.2-0.i386.rpm) had some problem cause from itself. it lack some lib and you need to download the package MySQL-shared-compat-4.0.23-0.i386.rpm and install it before install MySQL5.

    in the other way, the tar.gz installed, i had been tried two virsions that are mysql-standard-5.0.2-alpha-pc-linux-i686.tar.gz and mysql-max-5.0.2-alpha-pc-linux-i686.tar.gz, but only the max version was successfuly.
    i dont know reason why...

    which version do i choose? i m suggesting u try tar.gz. because it will let you sure it where is.

    ==============
    RPM installed
    ==============
    download packages:

    MySQL-shared-compat-4.0.23-0.i386.rpm
    MySQL-server-5.0.2-0.i386.rpm
    inst-rpm (make it and chmod 755)
    params '-i' install, '-e' is removing

    ex:[root@dns mysql502]#inst-rpm -i

    Code:

    #!/bin/sh
    #
    case "$1" in
    -i)
    echo Install MySQL-shared-compat-4.0.23-0 ...
    rpm -ivh MySQL-shared-compat-4.0.23-0.i386.rpm
    echo Install MySQL-server-5.0.2-0 ...
    rpm -ivh MySQL-server-5.0.2-0.i386.rpm
    exit 0;;
    -e)
    echo remove MySQL-shared-compat-4.0.23-0 ...
    rpm -e MySQL-shared-compat-4.0.23-0
    echo remove MySQL-server-5.0.2-0 ...
    rpm -e MySQL-server-5.0.2-0
    exit 0;;
    *)
    echo "Usage: $0 -i(install)|-e(remove)"
    exit 1;;
    esac


    =================
    tar.gz installed
    =================
    download packages:

    mysql-max-5.0.2-alpha-pc-linux-i686.tar.gz

    fix files:
    mysql
    my.cnf

    make it and chmod 755:
    inst-mysql
    uninst

    pre-works:
    you have to prepare the fix files both mysql and my.cnf before installing.
    package mysql-max-5.0.2-alpha-pc-linux-i686.tar.gz is named package under list.
    mysql is come from file in package /support-files/mysql.server.
    my.cnf is come from file in package /support-files/my-medium.cnf.

    replace the content of mysql.server
    ------------------------------------
    at last of mysql.server, change it and save as mysql, it will show how it is alive. (you will see pid when using the system setting tool )

    Code:

    *)
    if test -f "$pid_file" ;then
    echo "MySQL(pid = `cat $pid_file`) is running ..."
    else
    # usage
    echo "Usage: $0 start|stop|restart"
    exit 1
    fi
    ;;
    esac



    replace the content of my-medium.cnf
    -------------------------------------
    have some setting is needed in my-medium.cnf before save as my.cnf
    there are socket path, client username, mysqld start username(for some safe reason) and default character set. i suggest using the UTF-8 to avoid some malformed character problems.

    Code:

    [client]
    user = YouWishName
    password = YourPassword
    port = 3306
    socket = /tmp/mysql.sock
    default-character-set = utf8
    ...

    [mysqld]
    basedir = /usr/local/mysql
    user = mysql
    port = 3306
    socket = /tmp/mysql.sock
    default-character-set = utf8
    ...


    inst-mysql
    -----------
    first, you have to replace the path suit to your environment

    Code:

    printf "%s\n" "make mysql service"
    cp /home/download/mysql502/mysql /etc/init.d

    Code:

    printf "%s\n" "change mysql env"
    cp /home/download/mysql502/my.cnf /etc


    starting install...
    invocation you be successful
    dont forgot change the root password after installed...

    Code:

    #!/bin/sh
    ##################################################
    # install mysql on fc3
    #-------------------------------------------------
    # MySQL-5.0
    # mysql-max-5.0.2-alpha-pc-linux-i686.tar.gz
    #
    # author:kowala 2005/03/03
    ##################################################
    mysqlgz=mysql-max-5.0.2-alpha-pc-linux-i686.tar.gz

    mysqlname=${mysqlgz%".tar.gz"}
    mypath=/usr/$mysqlname

    printf "%s\n\n" "install mysql on fc3"
    printf "%s\n" "unpack $mysqlgz to /usr ..."

    tar -xzvf $mysqlgz -C /usr

    printf "%s\n" "create user mysql"
    useradd mysql

    printf "%s\n" "create short-path: ln -s $mypath /usr/local/mysql"
    ln -s $mypath /usr/local/mysql

    mypath=/usr/local/mysql

    if test -d $mypath; then
    printf "%s\n" "change dir to /usr/local/mysql"
    cd $mypath
    printf "%s\n" "change owner ..."
    chown -R root .
    chown -R mysql data
    chgrp -R mysql .
    fi

    printf "%s\n" "create initial DB scripts/mysql_install_db --user=mysql"
    scripts/mysql_install_db --user=mysql

    printf "%s\n" "make mysql service"
    cp /home/download/mysql502/mysql /etc/init.d
    chkconfig --add mysql
    chkconfig --level 2345 mysql on
    chkconfig --level 016 mysql off
    printf "%s\n" "start up mysql service..."
    service mysql start

    printf "%s\n" "change mysql env"
    cp /home/download/mysql502/my.cnf /etc

    printf "%s...\n" "restart mysql service..."
    service mysql restart

    #alias mysql=/usr/local/mysql/bin/mysql
    #alias mysqladmin=/usr/local/mysql/bin/mysqladmin
    printf "%s\n" "change password of user root after installed..."
    echo default is no password, press Enter key...
    echo alias mysql=/usr/local/mysql/bin/mysql
    echo mysql -u root -p mysqlecho "UPDATE user SET Password=PASSWORD('new password') WHERE user='root';"
    echo "FLUSH PRIVILEGES;"

    uninst
    -------
    it remove mysql installed, dont be changed.

    Code:

    #!/bin/sh
    ####################################
    # uninst.sh
    # it will uninstall mysql max 5.0.2
    #####################################
    mysqllocate=/usr/mysql-max-5.0.2-alpha-pc-linux-i686

    printf "%s...\n" "ready to remove MySQL max 5.0.2 ..."
    printf "%s...\n" "stop mysql service..."
    service mysql stop

    printf "%s...\n" "remove short-path of mysql ..."
    rm /usr/local/mysql

    printf "%s...\n" "remove dir $mysqllocate ..."
    rm -rf $mysqllocate

    printf "%s...\n" "remove mysql service ..."
    chkconfig --del mysql

    printf "%s...\n" "remove start up bash file /etc/init.d/mysql ..."
    rm /etc/init.d/mysql

    printf "%s...\n" "remove setting file /etc/my.cnf ..."
    rm /etc/my.cnf

    printf "%s...\n" "remove mysql user ..."
    userdel -r mysql

    printf "%s...\n" "remove finished ..."

  • 相关阅读:
    [LeetCode] 226. Invert Binary Tree
    [LeetCode] 101. Symmetric Tree
    [LeetCode] 100. Same Tree
    [LeetCode] 104. Maximum Depth of Binary Tree
    [LeetCode] 280. Wiggle Sort
    [LeetCode] 42. Trapping Rain Water
    [LeetCode] 190. Reverse Bits
    [LeetCode] 144. Binary Tree Preorder Traversal
    [Leetcode] 58. Length of Last Word
    [LeetCode] 16. 3Sum Closest
  • 原文地址:https://www.cnblogs.com/huqingyu/p/207324.html
Copyright © 2020-2023  润新知