MySQL 5.7.22 二进制安装

MySQL 5.7.22 二进制安装

一、到官网下载mysql-5.7.22二进制包

二、创建mysql用户:

        useradd mysql -s /sbin/nologin -M

三、解压mysql-5.7.22-el7-x86_64.tar.gz :

        tar xf mysql-5.7.22-el7-x86_64.tar.gz  && mv mysql-5.7.22-el7-x86_64.tar.gz  /opt/mysql 

四、创建相关目录:

        cd /opt/mysql    mkdir {data,logs,etc}   mkidr logs/binlog

五、修改权限:

        cd /opt/ && chown -R mysql.mysql mysql

六、初始化数据库:

        cd /opt/mysql
        ./bin/mysqld  --initialize --user=mysql --basedir=/opt/mysql --datadir=/opt/mysql/data
        记住最后提示的密码

七、修改my.cnf文件:

        echo > /etc/my.cnf     vi my.cnf 加入文档最后的内容

八、配置mysql服务:

        cd /opt/mysql && cp  support-files/mysql.server /etc/init.d/mysqld
        修改权限chmod +x /etc/init.d/mysqld
        编辑mysqld加入basedir=/opt/mysql   datadir=/opt/mysql/data
        chkconfig --add mysqld

九、启动mysql服务:

        service mysqld start
        此时会报日志错误:Starting MySQL.2018-07-26T14:24:53.192088Z mysqld_safe error: log-error set to                   ‘/opt/mysql/logs/mysql-error.log‘, however file don‘t exists. Create writable for user ‘mysql‘.
                ERROR! The server quit without updating PID file (/opt/mysql/data/mysql.pid).
        原因是找不到logs下的mysql-error.log文件
        我们手动创建一个
        touch /opt/mysql/logs/mysql-error.log&&chown mysql.mysql mysql-error.log
        再执行service mysqld start 即可

十、配置环境变量:

        cd &&vi .bash_profile  在PATH后加上/opt/mysql/bin,保存退出
        执行source .bash_profile

十一、登录数据库,修改密码:

        启动服务后,执行mysql -uroot -p 输入初始化时的密码
        执行show databases; 会报错ERROR 1820 (HY000): You must reset your password using ALTER USER          statement before executing this statement.
        执行set PASSWORD=PASSWORD(‘123456‘); flush privileges 修改密码
        退出后用新密码可以重新登录

至此,Mysql-5.7.22二进制方式安装完成

my.cnf可选内容

[mysqld]
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
basedir=/opt/mysql                              #介质目录
datadir=/opt/mysql/data                         #数据目录
port=3306                                          #端口
pid-file = /opt/mysql/data/mysql.pid            #进程id
user = mysql                                       #启动用户
socket=/opt/mysql/data/mysql.sock                #sock文件地址
bind-address = 0.0.0.0                             #绑定ip 这里表示绑定所有ip
server-id = 1                                      #用于复制环境钟标识实例,这个在复制环境里唯一
character-set-server = utf8                        #服务端默认字符集,很重要,错误设置会出现乱码
max_connections = 1000                             #允许客户端并发连接的最大数量
max_connect_errors = 6000                          #如果客户端尝试连接的错误数量超过这个参数设置的值,则服务器不再接受新的客户端连接。
open_files_limit = 65535                           #操作系统允许MySQL服务打开的文件数量。
table_open_cache = 128                             #所有线程能打开的表的数量
max_allowed_packet = 4M                            #网络传输时单个数据包的大小。
back_log= 300
binlog_cache_size = 4M
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_type = 1
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 = /opt/mysql/logs/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /opt/mydql/logs/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
#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

[client]
port=3306
socket=/opt/mysql/data/mysql.sock

[mysql]
no-auto-rehash
#default-character-set=utf8
safe-updates
socket=/opt/mysql/data/mysql.sock

[mysqldump]
quick
max_allowed_packet = 32M

[mysqlhotcopy]
interactive-timeout

[mysql_safe]
open-files-limit = 8192

原文地址:http://blog.51cto.com/445153/2152520

时间: 2024-11-10 13:35:34

MySQL 5.7.22 二进制安装的相关文章

mysql之source编译,二进制安装以及权限分配等

MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于 Oracle 旗下公司,由于其体积小.速度快.总体拥有成本低,尤其是开放源码这一特点,一般中小型网站的开发都选择 MySQL 作为网站数据库. mysql:流程图 mysql内部结构: 两种安装方式:源码编译,二进制安装. mysql source安装5.5 依赖: [[email protected]  tools]# yum install -y cmake [[email protected]  tools]

mysql 5.7.12二进制安装

1.my.cnf配置文件参数:vim /etc/my.cnf [client] port = 3306 socket = /tmp/mysql.sock [mysql] no-auto-rehash [mysqld] user = mysql port = 3306 socket = /tmp/mysql.sock basedir = /aliyun/server/mysql-5.7.12/ datadir = /data/mysql/data/ open_files_limit = 1024

Mysql 5.6版本二进制安装

时间:2018.7.30作者:李强参考:man,info,magedu讲义,万能的internet实验环境:VMware? Workstation 12 Pro ,Centos 6.9,Centos 7.4,SecureCRT Version 8.1.4声明:以下英文纯属个人翻译,英文B级,欢迎纠正,以下内容纯属个人理解,并没有对错,只是参考,盗版不纠,才能有限,希望不误人子弟为好.版本:v1-2018.7.30 参考资料 1.https://www.cnblogs.com/BrightMoon

MySQL 8.0.13 二进制安装

MySQL 8.0 二进制安装大致与MySQL 5.7 类似 1.查询删除原有mysql使用rpm -qa | grep mysql 或mariadb 搜索 mysql,如果存在,使用rpm -e --nodeps mariadb-全部删除,或使用yum remove mysql mysql-server mysql-libs compat-mysql51全部删除:2.下载所需依赖包yum remove libnuma.so.1yum install make cmake libaio wget

MySQL 5.7.22 免安装配置

转自https://blog.csdn.net/hellboy0621/article/details/80458892 1.官网下载对应版本,下载地址为https://dev.mysql.com/downloads/mysql/5.7.html#downloads,我下载的文件为"mysql-5.7.22-winx64.zip": 2.考虑到数据库容量会增加,建议解压缩到可用容量较大的盘符,我解压缩到D盘: 3.进入解压缩目录,新建my.ini文件,内容如下: [mysqld]  

MySQL 5.6.19 二进制安装

1.        操作系统 CentOS release 6.2 (Final) 2.        创建用户和组 [[email protected]1 ~]# groupadd mysql [[email protected] ~]# useradd -r -g mysqlmysql 3.        解压安装包(解压到你想存储数据库数据的地方) [[email protected] ~]# cd /data [[email protected] data]# tar -xzvf /ro

mysql 5.7.21 二进制安装

1. 说明 适用于CentOS 6.*和CentOS 7.* 系统版本:CentOS 6.8_x86-64     mysql版本:mysql-5.7.21-linux-glibc2.5-x86_64.tar.gz mysql程序安装路径:/data/mysql mysql数据存放路径:/data/mysql/data socket存放路径: /data/mysql/mysql.sock 安装方式:二进制文件安装 2. 新建用户 [[email protected] ~]# yum instal

mysql5.7.22二进制安装

系统版本:centos6.5 内核:2.6第一步初始化: ./bin/mysqld --initialize --user=mysql --datadir=数据存放路径 --basedir=安装包路径第二步./bin/mysql_ssl_rsa_setup --datadir=数据存放路径第三部:./bin/mysqld --defaults-file=配置文件路径 --user=root第四步:(修改密码)set password = password('tongda666'); 注意:路径=

mysql 8.0.11 二进制安装

#!/bin/bash ## 2018-5-24 ## hequan mkdir -p /data/src/ cd /data/src/ if [ ! -f mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz ]; then wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz fi yum install -y numactl.x86