苟哥的笔记本
首页
文章归档
关于
文章归档
关于
首页
软件安装
,
编程
正文
编译安装Mysql5.7
苟哥
2021-05-24 PM
1088℃
0条
MySQL5.7版本有比较大的变化,在安装上也有不小区别,需要boost库,为了方便,我们直接安装自带boost的mysql(当然也可以先安装纯mysql,再单独安装boost库)。 #### 一、安装相关依赖 ```shell yum install -y gcc gcc-c++ cmake ncurses ncurses-devel bison ``` #### 二、下载mysql-boost源码包 ```shell mkdir ~/src cd src wget https://dev.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.25.tar.gz ``` #### 三、编译安装 1、添加mysql用户 ```shell useradd -s /sbin/nologin mysql ``` 2、创建mysql数据目录 ```shell mkdir -p /data/mysql/data chown -R mysql:mysql /data/mysql ``` 3、安装 ```shell mkdir /usr/local/mysql tar -xzvf mysql-boost-5.7.25.tar.gz /usr/local/mysql cmake -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_unicode_ci -DWITH_BOOST=boost make && make install ``` 4、配置 ```shell vim /etc/my.cnf ``` 根据自身实际需求修改配置项 ``` [client] #password = your_password port = 3306 socket = /tmp/mysql.sock [mysqld] port = 3306 socket = /tmp/mysql.sock datadir = /data/mysql/data default_storage_engine = InnoDB performance_schema_max_table_instances = 400 table_definition_cache = 400 skip-external-locking key_buffer_size = 32M max_allowed_packet = 100G table_open_cache = 128 sort_buffer_size = 768K net_buffer_length = 4K read_buffer_size = 768K read_rnd_buffer_size = 256K myisam_sort_buffer_size = 8M thread_cache_size = 16 query_cache_size = 16M tmp_table_size = 32M sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES explicit_defaults_for_timestamp = true #skip-name-resolve max_connections = 500 max_connect_errors = 100 open_files_limit = 65535 log-bin=mysql-bin binlog_format=mixed server-id = 1 expire_logs_days = 10 slow_query_log=1 slow-query-log-file=/data/mysql/mysql-slow.log long_query_time=3 #log_queries_not_using_indexes=on early-plugin-load = "" innodb_data_home_dir = /data/mysql/data innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /data/mysql/data innodb_buffer_pool_size = 128M innodb_log_file_size = 64M innodb_log_buffer_size = 16M innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50 innodb_max_dirty_pages_pct = 90 innodb_read_io_threads = 1 innodb_write_io_threads = 1 [mysqldump] quick max_allowed_packet = 500M [mysql] no-auto-rehash [myisamchk] key_buffer_size = 32M sort_buffer_size = 768K read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout ``` 5、初始化 ```shell cd /usr/local/mysql/bin ./mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/data ``` 6、添加环境变量 ```shell #在 /etc/profile 新增一行 PATH=/usr/local/mysql/bin:$PATH ``` 保存退出后让环境变量生效: ```shell source /etc/profile ``` 7、设置开机启动 ```shell ln -s /usr/local/mysql/bin/* /usr/local/bin/ cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld systemctl enable mysqld ``` 8、启动mysql并设置root密码 ```shell systemctl start mysqld mysql -uroot -p #初始密码为空,所以直接回车 ``` 修改密码 ```shell set password='123456' ```
标签:
编译安装mysql5.7
非特殊说明,本博所有文章均为博主原创。
如若转载,请注明出处:
http://www.i366211.com/archives/167/
上一篇
Hyperf快速生成文件的命令
下一篇
C++单例模式为啥是这样的?
取消回复
评论啦~
提交评论
栏目分类
软件安装
10
开发工具
8
算法
2
测试
1
架构
3
填坑记
2
开源
6
科普
6
私域
2
读书笔记
4
编程
48
运营
3
管理
1
标签云
算法
C程序设计语言
C语言
Java
mysql
PHP
ffmpeg
golang
VueJs
脚手架
VueJs实战项目
Intellij IDEA
Centos7
Hyperf
抖音运营
杰克韦尔奇
跌荡一百年
生成海量测试数据
企业管理
习题2-3
习题2-4
习题2-6
异常分类
File
习题2-7
习题2-8
习题2-9
习题3-3
习题3-4
习题3-5
友情链接
申请
SaaS引擎
机器人框架
京东捡漏