1、下载二进制文件
cd /data
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
2、下载mysql解压到/opt/mysql下
cd /opt
mkdir mysql
cd mysql
tar -zxvf /data/mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
3、创建一个软连接
cd /usr/local/
ln -s /opt/mysql/mysql-5.7.16-linux-glibc2.5-x86_64 mysql
4、创建用户
groupadd mysql
useradd -M -g mysql -s /sbin/nologin -d /usr/local/mysql mysql
5、给予我们的配置文件定的环境,创建基本的目录
mkdir /data/mysql
mkdir -p /data/mysql/mysql3306/{data,logs,tmp}
chown -R mysql:mysql /data/mysql/mysql3306
备注:
创建/etc/my.cnf
6、做MySQL初始化
cd /usr/local/mysql/
./bin/mysqld --initialize
./bin/mysqld --defaults-file=/etc/my.cnf --initialize
注:initialize必须放在最后
查看密码
cat /data/mysql/mysql3306/data/error.log | grep password
7、创建一个启动脚本
cd /usr/local/mysql/
cp support-files/mysql.server /etc/init.d/mysql
8、启动和关闭
/etc/init.d/mysql start | stop | restart
9、添加环境变量
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
10、进入mysql更改密码
mysql -S /tmp/mysql.sock -p
11、
alter user user() identified by 'mysql'
12、mysql -uroot -p 密码为mysql
#####################################################################
备注:/etc/my.cnf内容如下:
#my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock
[mysql]
prompt="\\u@\\h [\\d]>"
#pager="less -i -n -S"
#tee=/opt/mysql/query.log
no-auto-rehash
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin = /usr/local/mysql/bin/mysqladmin
log = /opt/mysql/mysqld_multi.log
[mysqld]
#misc
user = mysql
basedir = /usr/local/mysql
datadir = /data/mysql/mysql3306/data
port = 3306
socket = /tmp/mysql.sock
event_scheduler = 0
tmpdir = /data/mysql/mysql3306/tmp
#timeout
interactive_timeout = 300
wait_timeout = 300
#character set
character-set-server = utf8
open_files_limit = 65535
max_connections = 100
max_connect_errors = 100000
#lower_case_table_names =1
#logs
log-output=file
slow_query_log = 1
slow_query_log_file = slow.log
log-error = error.log
log_warnings = 2
pid-file = mysql.pid
long_query_time = 1
#log-slow-admin-statements = 1
#log-queries-not-using-indexes = 1
log-slow-slave-statements = 1
#binlog
#binlog_format = STATEMENT
binlog_format = row
server-id = 23306
log-bin = /data/mysql/mysql3306/logs/mysql-bin
binlog_cache_size = 4M
max_binlog_size = 256M
max_binlog_cache_size = 1M
sync_binlog = 0
expire_logs_days = 10
#procedure
log_bin_trust_function_creators=1
#
gtid-mode = 0
#relay log
skip_slave_start = 1
max_relay_log_size = 128M
relay_log_purge = 1
relay_log_recovery = 1
relay-log=relay-bin
relay-log-index=relay-bin.index
log_slave_updates
#slave-skip-errors=1032,1053,1062
#skip-grant-tables
#buffers & cache
table_open_cache = 2048
table_definition_cache = 2048
table_open_cache = 2048
max_heap_table_size = 96M
sort_buffer_size = 128K
join_buffer_size = 128K
thread_cache_size = 200
query_cache_size = 0
query_cache_type = 0
query_cache_limit = 256K
query_cache_min_res_unit = 512
thread_stack = 192K
tmp_table_size = 96M
key_buffer_size = 8M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 32M
#myisam
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
#innodb
innodb_buffer_pool_size = 100M
innodb_buffer_pool_instances = 1
innodb_data_file_path = ibdata1:100M:autoextend
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 8M
innodb_log_file_size = 100M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 50
innodb_file_per_table = 1
innodb_rollback_on_timeout
innodb_status_file = 1
innodb_io_capacity = 2000
transaction_isolation = READ-COMMITTED
innodb_flush_method = O_DIRECT
- Centos7.5 mysql5.7.26二进制安装方式
1 yum安装所需相关依赖包. yum -y install gcc-c++ yum -y install zlib zlib-devel pcre pcre-devel yum -y inst ...
- mysql5.6 通用二进制安装
mysql5.6 通用二进制安装: #卸载原有的mysqlyum remove mysql*ls /etc/my.cnf*mv /etc/my.cnf* /tmp/ #安装依赖包yum install ...
- mysql8.0.16二进制安装
mysql8.0.16二进制安装 环境简介操作系统:Centos 6.10 64位 目前版本:8.0.16 MySQL Community Server 二进制 安装目录:/data/mysql/my ...
- MySQL5.7 linux二进制安装
200 ? "200px" : this.width)!important;} --> 介绍 MySQL5.7出来也有大半年了,业内也一直在宣传5.7有多么的N,官网的也是宣 ...
- k8s-1.16 二进制安装
环境机器配置: 172.16.153.70 master 172.16.77.121 node1 172.16.77.122 node2 系统初始化 [root@iZbp1c31t0jo4w553hd ...
- MySQL5.7 windows二进制安装
200 ? "200px" : this.width)!important;} --> 介绍 1.下载解压 下载地址:http://dev.mysql.com/get/Dow ...
- centos7 安装mysql5.7(二进制安装)
一.卸载默认安装的mariadb [root@localhost ~]# yum remove mariadb* -y 二.添加mysql用户 [root@localhost ~]# useradd ...
- MySQL5.6的二进制安装
5.6 5.7 用的最多 差别不大. 首先从网上下在二进制文件 先去官网找到自己想要的版本 https://dev.mysql.com/downloads/mysql/ https://dev.mys ...
- 【MYSQL】MySQL5.6.37二进制安装
最近有个项目要用到mysql 于是在mysql的论坛中找到了一个5.6.37版本的 下面介绍怎么安装和使用mysql 下载地址: https://dev.mysql.com/downloads/mys ...
随机推荐
- 求一个int型整数的两种递减数之和(java)--2015华为机试题
题目描述: 给出一个整数(负数使用其绝对值),输出这个整数中的两种递减数(1.最大递减数:2.递减数中各位数之和最大的数)之和. 递减数:一个数字的递减数是指相邻的数位从大到小排列的数字,不包含相邻的 ...
- 运行错误:应用程序无法启动因为并行配置不正确。the application has failed to start because its side-by-side configuration is incorrect 解决方法
问题描述: 当电脑同时安装VS2008和VS2008 SP1时,编译出来的Visual C++程序的manifest 文件会默认引用VS2008的MFC版本和CRT版本.如下: <depende ...
- webstorm入手笔记
一.webstorm学习前小记 webstorm是一款现在前端用的比较多的IDE,其优势也比较多,这个大家在网上随便搜搜就可以找到了.但是本人大部分的时间都是使用sublime text工作,最近由于 ...
- 走入PHP-类与对象
PHP中用class来定义类,用new实例化对象,用extends继承类,不过只能单继承,属性和方法有public.private和protected做访问控制,默认为public,在类里定义常量不需 ...
- Pad控件 UIPopoverController的介绍与使用(Pad的专属菜单控件、Swift版本)
UIPopoverController 是iPad特有控件,iOS9之前,在iOS上也可以使用,在iOS9之后,只能用于Pad上. 如果非要在iOS上使用,编译不会有问题,运行后会崩溃,报错如下: T ...
- CentOS下查看nginx和php的编译参数
在已经编译安装好的nginx和php的server上是可以查看之前编译时候的参数的,方法如下. 1.查看nginx的编译参数 # nginx -V nginx version: nginx/1.9.4 ...
- [Python]获取子线程异常信息
起因 今天在写东西的时候,用到了多线程.遇到了个问题: 子线程的异常,在父线程中无法捕获. 解决 问题代码 问题代码示例代码如下: import threading class SampleThrea ...
- 【Egret】在WebStorm里使用Egret Engine 的注意点
1.开启代码提示 2.修改egret code后,自动编译新egret code 按照下图进行设置: ①打开"File-settings" ② ③ (PS:webstorm打开目录 ...
- 老李分享:《Linux Shell脚本攻略》 要点(五)
老李分享:<Linux Shell脚本攻略> 要点(五) //1.打包.解包 [root@localhost program_test]# tar -cf output.tar 11. ...
- JavaWeb项目实现文件上传动态显示进度
很久没有更新博客了,这段时间实在的忙的不可开交,项目马上就要上线了,要修补的东西太多了.当我在学习JavaWeb文件上传的时候,我就一直有一个疑问,网站上那些博客的图片是怎么上传的,因为当提交了表单之 ...