精华内容
下载资源
问答
  • mysql5.7二进制安装

    2016-04-12 17:34:48
    里面有mysql5.7二进制安装包的国内云盘下载地址,下载速度飞快,还有mysql配置好的参数文件my.cnf,还有自动化一键式安装脚本auto_install_mysql5.7.sh。把所有东西准备好之后,执行sh脚本,一次性安装好mysql5.7
  • MySQL5.7二进制安装

    2019-09-12 15:42:03
    MySQL5.7二进制安装 1.安装依赖,解压mysql二进制包到/usr/local/ ,并创建软链接mysql yum install bison-devel ncurses-devel libaio-devel wget ...

    MySQL5.7二进制安装


    安装依赖,解压mysql二进制包到/usr/local/ ,并创建软链接mysql

    yum install bison-devel ncurses-devel libaio-devel
    wget https://downloads.mysql.com/archives/get/file/mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz
    

    添加mysql环境变量

    vim /etc/profile.d/mysql.sh 
    export PATH=/usr/local/mysql/bin:$PATH
    

    创建mysql用户

    useradd -s /sbin/nologin mysql -M
    

    创建目录

    mkdir -p /data/mysql/{data,binlog}
    

    授权

    chown -R mysql.mysql /data/mysql
    

    初始化MySQL数据库

    mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/data
    

    systemd管理MySQL

    vim /etc/systemd/system/mysqld.service
    [Unit]
    Description=MySQL Server
    Documentation=man:mysqld(8)
    Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
    After=network.target
    After=syslog.target
    
    [Install]
    WantedBy=multi-user.target
    
    [Service]
    User=mysql
    Group=mysql
    ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf
    LimitNOFILE = 5000
    

    重新加载systemd

    systemctl daemon-reload
    

    配置文件

    vim /etc/my.cnf
    [mysqld]
    basedir=/usr/local/mysql
    datadir=/data/mysql/data
    user=mysql
    server_id=5106
    log-error=/data/mysql/error.log
    log_bin=/data/mysql/binlog/mysql-bin
    skip_name_resolve
    port=3306
    

    启动MySQL

    systemctl start mysqld.service
    

    创建库

    create database abc character set utf8 collate utf8_general_ci;
    create database bbsgo_db character set utf8mb4 collate utf8mb4_general_ci;
    
    展开全文
  • mysql5.7 二进制安装一键安装脚本 for ubuntu ubuntu 默认shell 是dash 请用 bash执行 /bin/bash mysql5.7_bin_install.sh
  • MySQL5.7 二进制安装

    2019-03-13 22:58:28
    解压MySQL5.7二进制包 [root@localhost tmp]# tar -zxvf mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz [root@localhost tmp]# tar -zxvf mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz 将解压后的文件放到指定...

    解压MySQL5.7二进制包

    [root@localhost tmp]# tar -zxvf mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz

    [root@localhost tmp]# tar -zxvf mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz

    将解压后的文件放到指定目录

    [root@localhost tmp]# mv mysql-5.7.25-linux-glibc2.12-x86_64 /usr/local/mysql

    *注意* 目录"/usr/local/mysql"必须不存在,否则会被拷贝到此目录下

    查看文件是否拷贝完全

    [root@localhost tmp]# ll /usr/local/mysql
    total 40
    drwxr-xr-x  2 mysql mysql  4096 Mar 14 22:11 bin
    -rw-r--r--  1 mysql mysql 17987 Dec 21 18:39 COPYING
    drwxr-xr-x  2 mysql mysql    55 Mar 14 22:11 docs
    drwxr-xr-x  3 mysql mysql  4096 Mar 14 22:10 include
    drwxr-xr-x  5 mysql mysql  4096 Mar 14 22:11 lib
    drwxr-xr-x  4 mysql mysql    30 Mar 14 22:11 man
    -rw-r--r--  1 mysql mysql  2478 Dec 21 18:39 README
    drwxr-xr-x 28 mysql mysql  4096 Mar 14 22:11 share
    drwxr-xr-x  2 mysql mysql    90 Mar 14 22:11 support-files

    创建mysql用户

    [root@localhost tmp]# useradd mysql

    创建所需目录并更改属主和属组

    [root@localhost tmp]# mkdir -p /data/mysql/data
    [root@localhost tmp]# mkdir -p /data/mysql/logs
    [root@localhost tmp]# chown mysql:mysql -R /data
    [root@localhost tmp]# chown mysql:mysql -R /usr/local/mysql

    编辑参数文件

    [root@localhost tmp]# cat > /etc/my.cnf <<EOF
    [mysqld]
    # basic settings #
    user = mysql
    sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,ONLY_FULL_GROUP_BY"
    character_set_server=utf8mb4
    collation_server=utf8mb4_bin
    default-storage-engine=innodb
    pid-file=/data/mysql/data/mysql.pid
    socket=/tmp/mysql.sock
    basedir= /usr/local/mysql
    datadir=/data/mysql/data
    tmpdir=/tmp
    transaction-isolation = READ-COMMITTED
    explicit_defaults_for_timestamp = 1
    lower_case_table_names=1
    max_allowed_packet = 32M
    slave_pending_jobs_size_max = 32M
    event_scheduler = 1
    server-id=1383306
    port=3306
    symbolic-links=0
    sysdate-is-now
    show_compatibility_56=on
    back_log=1000
    # connection #
    interactive_timeout = 200
    wait_timeout = 200
    lock_wait_timeout = 1800
    skip_name_resolve = 1
    max_connections = 2000
    max_connect_errors = 100000
    
    # table cache performance settings #(??)
    table_open_cache = 3000
    table_definition_cache = 4096
    table_open_cache_instances = 16
    
    # session memory settings #(??)
    read_buffer_size = 2M
    read_rnd_buffer_size = 16M
    sort_buffer_size = 4M
    tmp_table_size = 100M
    max_heap_table_size = 100M
    join_buffer_size = 4M
    thread_cache_size = 64
    # log settings #
    general_log_file=/data/mysql/logs/general.log
    log-error=/data/mysql/logs/error.log
    slow_query_log = 1
    long_query_time = 1
    slow_query_log_file=/data/mysql/logs/slow-query.log
    log_queries_not_using_indexes = 1
    log_slow_admin_statements = 1
    log_slow_slave_statements = 1
    log_throttle_queries_not_using_indexes = 10
    binlog-rows-query-log-events = 1
    log-bin=/data/mysql/data/mysql-bin
    log-bin-index=/data/mysql/data/mysql-bin.index
    log_bin_trust_function_creators = 1
    binlog_cache_size=4M
    max_binlog_cache_size = 4096M
    max_binlog_size = 1024M
    expire-logs-days=3
    log-slave-updates = 1
    relay-log-index=/data/mysql/data/mysql-relay-bin.index
    relay-log=/data/mysql/data/mysql-relay-bin
    log_timestamps=system
    #log_warnings =2 #??????,?????log_error_verbosity=2
    log_error_verbosity=2
    
    # innodb settings #
    innodb_page_size = 16384
    innodb_data_home_dir=/data/mysql/data
    innodb_data_file_path=ibdata1:1024M:autoextend
    innodb_buffer_pool_size = 1G  #(??)
    innodb_buffer_pool_instances = 1
    innodb_buffer_pool_dump_pct = 40
    innodb_buffer_pool_load_at_startup = 1
    innodb_buffer_pool_dump_at_shutdown = 1
    innodb_lru_scan_depth = 4096
    innodb_lock_wait_timeout = 50
    innodb_rollback_on_timeout=1
    innodb_flush_log_at_trx_commit = 1
    innodb_io_capacity = 200
    innodb_max_dirty_pages_pct =75
    innodb_io_capacity_max = 1000
    innodb_flush_method = O_DIRECT
    innodb_file_format = Barracuda
    innodb_file_format_max = Barracuda
    innodb_undo_directory=/data/mysql/data #??,????
    innodb_undo_logs = 128
    innodb_undo_tablespaces = 3
    innodb_undo_log_truncate = 1 #????/??undo log ??truncate??
    innodb_max_undo_log_size = 2G
    innodb_purge_threads = 4
    innodb_purge_rseg_truncate_frequency = 128 #?????????????,??????
    innodb_flush_neighbors = 0 #ssd0,?ssd1
    innodb_log_buffer_size = 64M
    innodb_log_file_size = 256M
    innodb_log_files_in_group = 2
    innodb_log_group_home_dir=/data/mysql/data
    innodb_page_cleaners = 16
    innodb_large_prefix = 1
    innodb_thread_concurrency = 64
    innodb_sync_spin_loops=0 #???????,?????CPU??
    innodb_print_all_deadlocks = 1
    innodb_strict_mode = 1
    innodb_sort_buffer_size = 67108864
    innodb_write_io_threads = 16  #(??)
    innodb_read_io_threads = 16   #(??)
    innodb_file_per_table = 1
    innodb_stats_persistent_sample_pages = 64
    innodb_autoinc_lock_mode = 2
    innodb_online_alter_log_max_size=1G
    innodb_open_files=4096
    loose_innodb_numa_interleave=1
    
    # about query_cache #
    query_cache_type=0
    query_cache_size=0
    
    # replication settings #
    master_info_repository = TABLE
    relay_log_info_repository = TABLE
    sync_binlog = 1
    sync-relay-log =0
    sync-relay-log-info =0 #??relay_log_info_repository = TABLE,?mysql.slave_relay_log_info?innodb?,???????1,????innodb??N?
    gtid_mode = on
    enforce_gtid_consistency = 1
    log_slave_updates
    binlog_format = ROW
    binlog_rows_query_log_events = 1
    relay_log_recovery = 1
    slave_parallel_workers=20
    slave-parallel-type = LOGICAL_CLOCK
    slave_transaction_retries=128
    #slave_skip_errors = ddl_exist_errors
    slave-rows-search-algorithms = 'INDEX_SCAN,HASH_SCAN'
    log-slave-updates=true
    sync-master-info=1
    binlog-checksum=CRC32
    master-verify-checksum=1
    slave-sql-verify-checksum=1
    slave_preserve_commit_order=1
    read_only=0
    
    # GTID settings #
    gtid-mode=on
    enforce-gtid-consistency=true
    binlog_gtid_simple_recovery=1
    
    # SEMI Replication setting
    plugin-load="rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"
    rpl_semi_sync_master_enabled =1
    rpl_semi_sync_slave_enabled=1
    rpl_semi_sync_master_timeout=5000
    
    [mysqldump]
    quick
    max_allowed_packet = 32M
    
    [mysqld_safe]
    user=mysql
    open-files-limit=65536
    log-error=/data/mysql/logs/error.log
    > EOF

    配置环境变量

    [root@localhost tmp]# vim /home/mysql/.bash_profile
    
    # .bash_profile
    
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    
    # User specific environment and startup programs
    
    MYSQL_HOME=/usr/local/mysql
    
    PATH=$MYSQL_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin
    
    export PATH
    
    
    [root@localhost tmp]# . /home/mysql/.bash_profile

    初始化

    [root@localhost tmp]# /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --initialize-insecure --basedir=/usr/local/mysql --datadir=/data/mysql/data --user=mysql

    启动mysqld实例

    [root@localhost tmp]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql &

    登录到mysql添加密码

    [root@localhost tmp]# /usr/local/mysql/bin/mysql
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 3
    Server version: 5.7.25-log MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    [root@localhost][(none)]> grant all on *.* to root@localhost identified by "root";
    Query OK, 0 rows affected, 2 warnings (5.01 sec)
    
    [root@localhost][(none)]> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

     

    展开全文
  • mysql 5.7 二进制安装

    2017-07-18 21:57:14
    二进制 安装mysql5.7

    直接进入安装的话题,mysql5.7 已经 出来很久了,安装一下mysql 数据库


    首先根据自己的系统,我的系统centos6.8  64位,

    1首先下载 二进制安装包。

    cd /usr/local/src/
    wget  http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz  
    


    2解压 安装

    tar  zxvf  mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz 
    mv mysql-5.7.18-linux-glibc2.5-x86_64  /usr/local/mysql
    cd /usr/local/mysql/

    3添加mysql 用户,并且创建 mysql 的datadir 

    useradd -M -s /sbin/nologin  mysql 
    mkdir -p /data/mysql
    chown mysql /data/mysql
    

    4 初始化mysql

    ./bin/mysqld   --initialize --user=mysql --datadir=/data/mysql
    2017-07-17T21:16:04.187478Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2017-07-17T21:16:05.146566Z 0 [Warning] InnoDB: New log files created, LSN=45790
    2017-07-17T21:16:05.273795Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
    2017-07-17T21:16:05.347727Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 24d52603-6b35-11e7-9a99-000c29cd9738.
    2017-07-17T21:16:05.355372Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
    2017-07-17T21:16:05.359803Z 1 [Note] A temporary password is generated for root@localhost: 2t>Jutc2isnV
    注意 mysql 5.7  上面就是密码了, 是随机生成的密码。


    如果遇到错误:
    ./bin/mysqld   --initialize --user=mysql --datadir=/data/mysql
    ./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or    directory
    解决方案:
     yum install   -y   libaio.x86_64  libaio-devel.x86_64


    5 拷贝 配置文件,以及启动脚本

     cp support-files/my-default.cnf  /etc/my.cnf  
     vim /etc/my.cnf //编辑或者修改
    # These are commonly set, remove the # and set as required.
      basedir = /usr/local/mysql
      datadir = /data/mysql
      port = 3306
      socket = /tmp/mysql.sock

    提供一个简单的配置 my.cnf
    [mysqld]
    port            = 3306
    socket          = /tmp/mysql.sock
    datadir         = /data/mysql
    default-storage-engine = InnoDB
    #skip-locking
    explicit_defaults_for_timestamp = true
    
    
    # connection
    #skip-name-resolve
    #skip-networking
    max_connections = 1024
    max_connect_errors = 10000000
    wait_timeout = 15
    sql_mode = NO_ENGINE_SUBSTITUTION
    
    # character -default
    character_set_server=utf8
    
    # buffer & cache
    back_log = 300
    key_buffer_size = 256M
    max_allowed_packet = 32M
    sort_buffer_size = 8M
    read_buffer_size = 4M
    join_buffer_size = 4M
    #record_buffer = 2M
    read_rnd_buffer_size = 2M
    thread_cache_size = 128
    tmp_table_size = 128M
    query_cache_size = 0
    query_cache_type = 0
    max_heap_table_size = 96M

    拷贝启动 脚本

    cp support-files/mysql.server /etc/init.d/mysqld
    vi /etc/init.d/mysqld   //修改
    basedir=/usr/local/mysql
    datadir=/data/mysql

    6 加入到开机启动项

    chkconfig  --add  mysqld
    chkconfig  mysql on
    /etc/init.d/mysqld  start  

    7 连接mysql 

    mysql  -uroot -p'2t>Jutc2isnV'   
    进入 mysql后 第一件事情,就是要修改 root 密码,否则会报错
    第一次进入的时候
    mysql>  set password=password('123456');


    8 如果忘记了密码,也没有关系 有办法,编辑配置文件
    vi /etc/my.cnf
    在[mysqld]下面增加一行
    skip-grant-tables
    重启  /etc/init.d/mysqld restart
    这个时候就能免密登陆了。

    /usr/local/mysql/bin/mysql  -uroot
    mysql> use mysql;
    mysql> update user set authentication_string=password('newpassword') where user='root';
    mysql> flush privileges;
    

    退出来后,更改my.cnf,去掉刚加的 skip-grant-tables重启 /etc/init.d/mysqld restart


    在mysql5.7 ,对mysql.user  表  密码字段换成了 authentication_string     认证字符串. 这和5.6 稍有不同。


    参考文档
    http://www.cnblogs.com/gaojupeng/p/5727069.html
    http://blog.csdn.net/kk185800961/article/details/53170055








    展开全文
  • MySQL 5.7 二进制安装

    2018-11-29 11:52:45
    MySQL 在Linux 下的安装方式有 yum 、二进制 、源码安装,yum安装...这里主要介绍二进制安装。 1.查询删除原有mysql 使用rpm -qa | grep mysql搜索 mysql,如果存在,使用rpm -e --nodeps mariadb-*全部删除, 或...
    MySQL 在Linux 下的安装方式有 yum 、二进制 、源码安装,yum安装比较简单,这里不再介绍,
        二进制版本要求不高,适用于测试用,若是线上环境,还请使用源码安装。这里主要介绍二进制安装。
        1.查询删除原有mysql
        使用rpm -qa | grep mysql搜索 mysql,如果存在,使用rpm -e --nodeps mariadb-*全部删除,
        或使用yum remove mysql mysql-server mysql-libs compat-mysql51全部删除;
    
        2.下载所需依赖包
        yum remove libnuma.so.1
        yum install make cmake libaio wget -y
        yum install numactl.x86_64
    
        3.获取MySQL
        地址可以查看MySQL官网
        wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
    
        4.创建MySQL用户组和用户
        /usr/sbin/groupadd mysql
        /usr/sbin/useradd -g mysql mysql
    
     5.创建MySQL安装目录,数据目录,日志目录
     mkdir  /usr/app
     mkdir  /usr/app/mysqdata
     mkdir /usr/app/mysqllog
     修改文件权限
     chown -R mysql:mysql   /usr/app
    
     6.解压到安装目录 /usr/app
     tar -zxvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz -C /usr/app
     cd /usr/app
     mv mysql-5.7.22-linux-glibc2.12-x86_64 mysql
     chmod +w /usr/app/mysql
     目录/usr/app下执行
     chown -R mysql:mysql  ./
    
     7. /usr/app/mysql目录下初始化数据库
     bin/mysqld --initialize --user=mysql --basedir=/usr/app/mysql --datadir=/usr/app/mysqldata
     记录下最后一行 root@localhost: h_kkpM2fAyfi    mysql生成的root 临时密码
     ssl 验证 bin/mysql_ssl_rsa_setup  --datadir=/usr/app/mysqldata
    
     8.创建配置文件
     vi /etc/my.cnf
    
     [mysqld]
    
     #一般配置选项
     user=mysql
     port=3306
     server_id=1
     basedir= /usr/app/mysql
     datadir= /usr/app/mysqldata
    
     character_set_server=utf8
    
     pid_file=/usr/app/mysqldata/mysql.pid
     #socket = /var/run/mysqld/mysqld.sock
     #错误日志
     log_error= /usr/app/mysqldata/myerror.log
     #慢日志
     slow_query_log=1
     slow_query_log_file=/usr/app/mysqllog/mysql.slow
     long_query_time=5
     #bin_log日志
     log_bin=/usr/app/mysqllog/mysql_bin
     skip_external_locking
     skip_name_resolve
     #开启独立表空间
     innodb_file_per_table = on
    
     [mysql]
     no-auto-rehash
     #socket = /var/run/mysqld/mysqld.sock
     #default-character-set=utf8
     #safe-updates
    
     [client]
     loose-default-character-set = utf8
    
     9.配置mysqld
     cp mysql.server /etc/init.d/mysqld
     vim /etc/init.d/mysqld           ##修改basedir=  自己的路径     修改datadir= 自己的路径
    
     10.启动mysql服务
     /usr/app/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &
     报错:mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists.
     解决方法:
     #mkdir -p /var/run/mysqld
     #chown mysql:mysql /var/run/mysqld
    
     11.ps -ef|grep mysql  能看到类似下面的信息,说明启动成功;

    /bin/sh /usr/app/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf
    /usr/app/mysql/bin/mysqld --defaults-file=/etc/my.cnf --basedir=/usr/app/mysql/
    --datadir=/usr/app/mysqldata --plugin-dir=/usr/app/mysql/lib/plugin --user=mysql --log-error=/usr/app/mysqllog/mysql_error.log --pid-file=/usr/app/mysqldata/mysql.pid --socket=/var/run/mysqld/mysqld.sock

    12.添加环境变量
    echo "export PATH=$PATH:/usr/app/mysql/bin">>/etc/profile
        source /etc/profile
    
    13.连接登录
    mysql -u root -p
        如果连接不上 , 加 -S参数
        mysql -uroot -p -S /var/run/mysqld/mysqld.sock
    改密码:
    alter user 'root'@'localhost' identified by '123456';
    flush privileges;
    退出重启
    /etc/init.d/mysqld restart
    
        14.添加开机启动
        chmod +x /etc/init.d/mysqld
    chkconfig --add mysqld
    chkconfig mysqld on

    转载于:https://blog.51cto.com/11103985/2323586

    展开全文
  • mysql5.7二进制安装以及GTID复制mysql5.7二进制安装解压缩文件创建用户mysql创建软链接把客户端工具写到PATH变量里,然后执行使其生效创建...mysql5.7二进制安装 解压缩文件 tar xvf mysql-5.7.26-el7-x86_64.tar.
  • MySQL 5.7二进制安装

    2021-01-06 14:13:15
    挂载数据盘 在这里面我使用的是两块硬盘,一块是系统盘,另一块我用来存储数据库的数据,防止因为系统的原因丢失数据。 未挂载第块盘 df -h fdisk -l 格式化第块盘 mkfs.xfs /dev/sdb ...安装mysql 上传my.

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 15,336
精华内容 6,134
关键字:

mysql5.7二进制安装

mysql 订阅