zoukankan      html  css  js  c++  java
  • centos 5.8 64位系统安装 mysql5.6

            mysql5.5以上的版本编译需要 cmake

            1 、安装cmake

              wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
    
              tar -zxvf cmake-2.8.10.2.tar.gz
    
              cd cmake-2.8.10.2
    
              ./configure
    
              make
    
              make install
    
              make clean
    
              到此 cmake安装完毕

            2 、安装 mysql

               1 下载mysql 

                 官方下载地址  http://dev.mysql.com/downloads/mysql

                  选择Source Code  

                  我下载的是 Generic Linux (Architecture Independent), Compressed TAR Archive 这个版本(当前的版本是5.6.26)

                  把下载好的文件上传到linux服务器

                  或者直接 wget  http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.26.tar.gz

               2  检查是否已经安装了mysql   

            rpm -qa | grep mysql  (如果已经安装了需先卸载)  
    
            rpm -e --nodeps mysql-libs-5.1.61-4.el6.x86_64  (卸载mysql 卸载版本名称以实际的为准)

               3 安装mysql

                 

              yum -y install make gcc-c++ bison-devel  ncurses-devel  //安装mysql所需要的依赖包
    groupadd mysql (增加mysql用户组) useradd -g mysql -s /sbin/nologin mysql (增加mysql用户 不允许直接登录) tar -zxvf mysql-5.6.26.tar.gz cd mysql-5.6.26 cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 (cmake 编译mysql)
    make make install make clean
    chown -R mysql:mysql /usr/local/mysql chmod 755 /usr/local/mysql/scripts/mysql_install_db (赋给文件执行权限) /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld chmod 755 /etc/init.d/mysqld chkconfig --add mysqld chkconfig mysqld on

    编辑 /etc/init.d/my.cnf //mysql的配置文件写入如下内容 根据实际情况修改
          #########################################################

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

    
    

                [mysqld]
                socket=/tmp/mysql.sock
                port = 3306
                basedir = /usr/local/mysql
                datadir=/www/mysql/data
                pid-file = /www/mysql/data/mysql.pid
                user = mysql
                bind-address = 0.0.0.0
                server-id = 1
                skip-name-resolve
                back_log = 600
                max_connections = 1000
                max_connect_errors = 6000
                open_files_limit = 65535
                table_open_cache = 128
                max_allowed_packet = 4M
                binlog_cache_size = 1M
                max_heap_table_size = 8M
                tmp_table_size = 16M

    
    

                read_buffer_size = 2M
                read_rnd_buffer_size = 8M
                sort_buffer_size = 8M
                join_buffer_size = 8M
                key_buffer_size = 4M

                thread_cache_size = 8

                query_cache_size = 8M
                query_cache_limit = 2M

                ft_min_word_len = 4

                log_bin = mysql-bin
                binlog_format = mixed
                expire_logs_days = 30

                log_error = /www/mysql/data/mysql-error.log
                slow_query_log = 1
                long_query_time = 1
                slow_query_log_file = /www/mysql/data/mysql-slow.log

                performance_schema = 0
                explicit_defaults_for_timestamp

                #lower_case_table_names = 1

                skip-external-locking

                default_storage_engine = InnoDB
                #default-storage-engine = MyISAM
                innodb_file_per_table = 1
                innodb_open_files = 500
                innodb_buffer_pool_size = 64M
                innodb_write_io_threads = 4
                innodb_read_io_threads = 4
                innodb_thread_concurrency = 0
                innodb_purge_threads = 1
                innodb_flush_log_at_trx_commit = 2
                innodb_log_buffer_size = 2M
                innodb_log_file_size = 32M
                innodb_log_files_in_group = 3
                innodb_max_dirty_pages_pct = 90
                innodb_lock_wait_timeout = 120

                bulk_insert_buffer_size = 8M
                myisam_sort_buffer_size = 8M
                myisam_max_sort_file_size = 10G
                myisam_repair_threads = 1

              interactive_timeout = 28800

                wait_timeout = 28800

    
    

                [mysqldump]
                  quick
                  max_allowed_packet = 16M

    
    

                [myisamchk]
                  key_buffer_size = 8M
                  sort_buffer_size = 8M
                  read_buffer = 4M
                  write_buffer = 4M

          ##########################################################
          
    service mysqld restart 添加到环境变量 vi
    /etc/profile 添加如下代码 export PATH="$PATH:/usr/local/mysql/bin" source /etc/profile 登录mysql mysql -uroot -p //登陆mysql 第一次登陆的时候不需要输入密码 use mysql; delete from user where User=''; //删除用户名为空的用户 UPDATE user SET password=PASSWORD("123456") WHERE user='root'; //修改root用户的密码 mysql增加用户的命令 grant all privileges on db_test.* to db_user@"%" identified by '123456' with grant option; 这样就为 数据库 db_test 增加了一个 db_user的用户操作的权限 默认密码为 123456 flush privileges;//刷新权限

    重启服务器,看mysql是否随着开机启动

     

  • 相关阅读:
    HashMap是无序的
    mysql随笔
    visual stdio 安装OpenGL库文件
    myeclipse解决JSP文件里script背景颜色的调整
    js的鼠标事件整理-------Day47
    Linux环境编程之IPC进程间通信(五):Posix消息队列1
    HDFS 读取、写入、遍历文件夹获取文件全路径、append
    Appfuse搭建过程(下源代码不须要maven,lib直接就在项目里(否则痛苦死!))
    CSS样式命名规则
    关于c++ list容器的操作摸索
  • 原文地址:https://www.cnblogs.com/jackspider/p/4435153.html
Copyright © 2011-2022 走看看