• mysql5.6源码安装


    1.环境介绍:

      包:mysql-5.6.24.tar.gz

      平台:centos6.5

    2.安装cmake编译工具和依赖包:

    yum install cmake -y
    yum install ncurses
    ncurses-devel -y

    yum install openssl openssl-devel -y
    yum install bison -y
    yum install gcc
    -c++ -y
    yum install gcc
    -y

    3.创建mysql用户:

    useradd mysql -s /sbin/nologin

    4.安装编译mysql

      a.进入mysql安装目录

      b.cmake编译:

    cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/var/lib/mysql -DSYSCONFDIR=/etc -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EMBEDDED_SERVER=1 -DWITH_SSL=system

      参数说明:

        -DCMAKE_INSTALL_PREFIX:指定mysql主目录

               -DMYSQL_DATADIR:指定数据文件存放位置

               -DSYSCONFDIR:指定my.cnf路径

               -DMYSQL_UNIX_ADDR:指定连接数据库socket文件路径

            -DENABLED_LOCAL_INFILE=1:允许从本地导入数据

            -DEXTRA_CHARSETS=all:安装所有的字符集

            -DDEFAULT_CHARSET=utf8:指定默认字符

            -DWITH_PARTITION_STORAGE_ENGINE=1:安装支持数据库分区

      c.gmake

      d.make install

         e.如果报错

    make[2]: *** [libmysqld/examples/mysql_client_test_embedded] 错误 1
    make[1]: *** [libmysqld/examples/CMakeFiles/mysql_client_test_embedded.dir/all] 错误 2

    解决:加上如下

    -DWITH_EMBEDDED_SERVER=OFF

    5.cp相关文件和修改参数:

      a.拷贝

    cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
    cp
    /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

      b.修改参数(创建目录:mkdir /var/lib/mysql):

    [client]
    port = 53307
    socket = /tmp/mysqld.sock
    
    [mysql]
    no-auto-rehash
    
    [mysqld]
    user = mysql
    port = 53307
    socket = /tmp/mysqld.sock
    basedir = /usr/local/mysql
    datadir = /var/lib/mysql
    open_files_limit=10240
    
    character-set-server = utf8

    back_log
    = 600 max_connections = 3000 max_connect_errors = 6000 table_open_cache = 4096 external-locking = FALSE max_allowed_packet = 32M sort_buffer_size = 2M join_buffer_size = 2M thread_cache_size = 300 thread_concurrency = 8 query_cache_size = 64M query_cache_limit = 4M query_cache_min_res_unit = 2k default-storage-engine = MyISAM thread_stack = 192K transaction_isolation = READ-COMMITTED tmp_table_size = 256M max_heap_table_size = 256M slow-query-log=0 slow_query_log_file=/usr/local/mysql/slow-log.log long_query_time=2 log-bin binlog_cache_size = 4M max_binlog_cache_size = 8M max_binlog_size = 512M expire_logs_days = 7 key_buffer_size = 2048M read_buffer_size = 1M read_rnd_buffer_size = 16M bulk_insert_buffer_size = 64M myisam_sort_buffer_size = 128M myisam_max_sort_file_size = 10G myisam_repair_threads = 1 myisam_recover skip-name-resolve lower_case_table_names = 1 [mysqldump] quick max_allowed_packet = 32M [mysqld_safe] log-error=/usr/local/mysql/mysql.err pid-file=/usr/local/mysql/mysqld.pid

    6.修改环境变量:

    vim .bash_profile

    PATH=$PATH:$HOME/bin:/usr/local/mysql/bin

     7.运行mysql_install_db文件:

    ./mysql_install_db --basedir=/usr/local/mysql --datadir=/var/lib/mysql --no-default --user=mysql

    centos7初始化报错:

    FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:
    Data::Dumper
    

    解决:

    先用list 查找下module:

    #yum list|grep -i perl-modul*
    perl-Module-Build.noarch                   2:0.40.05-2.el7             base     
    perl-Module-CoreList.noarch                1:2.76.02-283.el7           base     
    perl-Module-Implementation.noarch          0.06-6.el7                  base     
    perl-Module-Install.noarch                 1.06-4.el7                  base     
    perl-Module-Load.noarch                    1:0.24-3.el7                base     
    perl-Module-Load-Conditional.noarch        0.54-2.0.1.el7.centos       base     
    perl-Module-Loaded.noarch                  1:0.08-283.el7              base     
    perl-Module-Manifest.noarch                1.08-10.el7                 base     
    perl-Module-Metadata.noarch                1.000018-2.el7              base     
    perl-Module-Pluggable.noarch               1:4.8-3.el7                 base     
    perl-Module-Runtime.noarch                 0.013-4.el7                 base     
    perl-Module-ScanDeps.noarch                1.10-3.el7                  base     
    perl-Module-Signature.noarch               0.73-2.el7                  base     

    安装 perl-module:

    yum install -y perl-Module-Install.noarch

    再次报错:

    Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

    解决方法:安装 libaio

    yum install -y libaio libaio-devel

    8.启动mysql服务:

    service mysql start

    9.查看mysql进程:

    ps –ef|grep mysql
  • 相关阅读:
    设计模式JS中的单例模式应用(一)
    SSD5_ Exercise 4分析
    JavaEE学习笔记
    SSD5_Exercise5分析
    SSD5_Optional Exercise6分析
    ACM相关网站
    hdu 2066 一个人的旅行【Dijkstra 12级新生训练—图论E】
    新队员图论基础_【CSUST_12级训练】
    hdu 2112 Today【F map + Floyd 入门训练】
    turtle库笔记
  • 原文地址:https://www.cnblogs.com/vijayfly/p/5054927.html
Copyright © 2020-2023  润新知