zoukankan      html  css  js  c++  java
  • linux编译安装mysql

    创建mysql用户

    groupadd mysql
    useradd -g mysql mysql

    mysql编译安装

    wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.70.tar.gz
    tar -zxvf mysql-5.1.70.tar.gz
    cd mysql-5.1.70
     
    yum install ncurses ncurses-devel
    ./configure  '--prefix=/usr/local/mysql' '--without-debug' '--with-charset=utf8' '--with-extra-charsets=all' '--enable-assembler' '--with-pthread' '--enable-thread-safe-client' '--with-mysqld-ldflags=-all-static' '--with-client-ldflags=-all-static' '--with-big-tables' '--with-readline' '--with-ssl' '--with-embedded-server' '--enable-local-infile' '--with-plugins=innobase'
    make
    make install

    下面开始mysql的配置工作

    1.安装mysql选项文件

    cp support-files/my-medium.cnf /etc/my.cnf

    2.mysql设置开机自启动

    cp -r support-files/mysql.server /etc/init.d/mysqld 
    /sbin/chkconfig --del mysqld
    /sbin/chkconfig --add mysqld

    3.配置权限表

    chown -R mysql:mysql /usr/local/mysql
    /usr/local/mysql/bin/mysql_install_db --user=mysql

    可能出现的问题:

    130925 10:08:28 [Warning] '--skip-locking' is deprecated and will be removed
    解决办法:
    vim /etc/my.cnf
    找到:skip-locking
    改为:skip-external-locking
    WARNING: The host 'xxx' could not be looked up with resolveip.
    解决办法,增加host:
    vim /etc/host
    127.0.0.1 xxx

    4.启动mysql

    sudo sh /etc/init.d/mysqld start

    开机启动mysql

    chmod 755 /etc/init.d/mysqld 
    chkconfig --add mysqld
    chkconfig --level 345 mysqld on 
    chkconfig --list mysqld

    mysql初始化配置:

    vim /etc/profile
    最下面写入:
    PATH=/usr/local/mysql/bin:$PATH

    初始化配置mysql

    /usr/local/mysql/bin/mysql_secure_installation

    mysql如何导入旧的数据:

    直接拷贝数据库文件夹到数据目录下然后执行

    /usr/local/mysql/bin/mysqladmin -u root -p flush-tables
  • 相关阅读:
    各种数据库查询表及表信息的SQL
    多维表头的DataGridView
    SQLite入门笔记
    配置WCF的心得
    JS键盘的键码
    ASP.NET的URL过滤
    利用反射查看类成员
    一个简单的MVC示例
    一个日志类 LogUtil
    一个IniHelper
  • 原文地址:https://www.cnblogs.com/simon-sun/p/3337516.html
Copyright © 2011-2022 走看看