博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
编译mysql5.6.27
阅读量:6615 次
发布时间:2019-06-25

本文共 4832 字,大约阅读时间需要 16 分钟。

hot3.png

yum install gcc gcc-c++ bzip2-devel bzip2-libs python-devel ncurses-devel bison perl-Module-Install.noarch -y

cd /usr/local/src/

wget "http://distfiles.macports.org/cmake/cmake-3.6.2.tar.gz"

tar -zxvf cmake-3.6.2.tar.gz

cd cmake-3.6.2

./bootstrap

gmake && gmake install

 

cd ..

wget "http://mirror.neu.edu.cn/mysql/Downloads/MySQL-5.6/mysql-5.6.27.tar.gz"

tar -zxvf mysql-5.6.27.tar.gz

cd mysql-5.6.27

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.27 \-DMYSQL_DATADIR=/data/mysql/ \-DSYSCONFDIR=/etc \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_MEMORY_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \-DMYSQL_TCP_PORT=4568 \-DENABLED_LOCAL_INFILE=1 \-DWITH_PARTITION_STORAGE_ENGINE=1 \-DEXTRA_CHARSETS=all \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci

make && make install

 

创建mysql目录级修改权限

groupadd mysql

useradd -M -s /sbin/nologin -g mysql mysql

mkdir -p /data/mysql/data

mkdir -p /data/mysql/log

chown mysql:mysql -R /data/mysql/

 

主配置

vi /etc/my.cnf

[client]port = 4568socket = /data/mysql/log/mysql.sock[mysqld]user = mysqlport = 4568character-set-server = utf8default-storage-engine = InnoDBsocket = /data/mysql/log/mysql.sockpid-file = /data/mysql/log/mysql.pid# DATA STORAGE #datadir = /data/mysql/datainnodb_data_file_path = ibdata1:1024M:autoextendinnodb_data_home_dir = /data/mysql/datainnodb_log_group_home_dir = /data/mysql/data# MyISAM #key-buffer-size = 16M# SAFETY #back_log = 512max-allowed-packet = 16Mmax-connect-errors = 1000wait_timeout = 100interactive_timeout = 100skip-name-resolveskip-external-lockingevent_scheduler = OFFexplicit-defaults-for-timestamp =1sysdate-is-now = 1innodb = FORCE# BINARY LOGGING ##log-bin = /data/mysql/log/mysql-binlog-bin = /data/mysql/log/mysql-binbinlog-format = mixedexpire-logs-days = 7sync-binlog = 100binlog_cache_size = 8M# REPLICATION #server-id = 4relay-log = /data/mysql/log/relay-binslave-net-timeout = 60# CACHES AND LIMITS #tmp-table-size = 512Mmax-heap-table-size = 64Mquery-cache-type = 0query-cache-size = 0max-connections = 500thread-cache-size = 2000open-files-limit = 65535table-definition-cache = 4096table-open-cache = 20480transaction_isolation = READ-COMMITTEDskip-external-locking = 1# INNODB #innodb-flush-method = O_DIRECTinnodb-log-files-in-group = 2innodb-log-file-size = 256Minnodb-buffer-pool-size = 4Ginnodb_read_io_threads = 4innodb_write_io_threads = 4innodb_io_capacity = 500innodb_strict_mode = 1innodb_file_format = Barracudainnodb_file_format_max = Barracudainnodb_purge_threads = 1innodb_use_sys_mallocinnodb_additional_mem_pool_size = 8Minnodb-flush-log-at-trx-commit = 2innodb-file-per-table = 1innodb_support_xa = 0# BUFFER #read_buffer_size = 2Mjoin_buffer_size = 2Msort_buffer_size = 2M# LOGGING #log-error = /data/mysql/log/mysql-error.loglog-queries-not-using-indexes = 0slow-query-log = 1long_query_time = 2slow-query-log-file = /data/mysql/log/mysql-slow.log

 

=======================

初始化

/usr/local/mysql-5.6.27/scripts/mysql_install_db --basedir=/usr/local/mysql-5.6.27 --datadir=/data/mysql/data --defaults-file=/etc/my.cnf

===================

创建快捷启动级开机服务启动

vi /lib/systemd/system/mysql.service

[Unit]Description=The MYSQL Process ManagerAfter=network.target[Service]Type=forkingExecStart=/usr/local/mysql-5.6.27/support-files/mysql.server startExecReload=/usr/local/mysql-5.6.27/support-files/mysql.server restartExecStop=/usr/local/mysql-5.6.27/support-files/mysql.server stopPrivateTmp=true[Install]WantedBy=multi-user.target

 

chmod +x /lib/systemd/system/mysql.service

systemctl enable mysql.service

systemctl start mysql.service

=======================

启动mysql创建本地管理帐号及删除无密码帐号

/usr/local/mysql-5.6.27/bin/mysqladmin -u root password 'orange#123'

/usr/local/mysql-5.6.27/bin/mysql -uroot -p'orange#123' -e "delete from mysql.user where password='';"

/usr/local/mysql-5.6.27/bin/mysql -uroot -p'orange#123' -e "flush privileges;"

 

#添加环境变量

vi /etc/profile

#add path for mysql

MYSQL_PATH=/usr/local/mysql-5.6.27/bin/

PATH=$PATH:$MYSQL_PATH

export PATH MYSQL_PATH

 

创建用户

/usr/local/mysql-5.6.27/bin/mysql -uroot -p

create user 'orange'@'%' identified by 'Hu#jgh%GVhb@5dGf35';

grant all privileges on *.* to 'orange'@'%';

flush privileges;

 

//备份语句

/usr/local/mysql-5.6.27/bin/mysqldump -udumper -p‘back#123654’ -hlocalhost -P4568 orange > orange_`date +%F_%T`.sql

//还原语句

mysql -uroot -p123456 orange</data/mysql_backup/orange_2017-04-07_11\:15\:00.sql

 

主从

从库账号密码

/usr/local/mysql-5.6.27/bin/mysqladmin -u root password 'sd#dfJGR8674#@%fgjk'

创建从者账号

CREATE USER 'slaver'@'%' IDENTIFIED BY 'sd#dfJGR8674#@%fgjk';

GRANT REPLICATION SLAVE ON *.* TO 'slaver'@'%';

CHANGE MASTER TO MASTER_HOST='120.77.254.17',MASTER_USER='slaver',MASTER_PASSWORD='sd#dfJGR8674#@%fgjk',MASTER_LOG_FILE='mysql-bin.000009',MASTER_LOG_POS=120;

 

 

 

 

转载于:https://my.oschina.net/yule526751/blog/896821

你可能感兴趣的文章
浏览器与服务器的消息通信
查看>>
把《Effective C++》读薄
查看>>
go slice和数组的区别
查看>>
21.7 windows_21_Library_Variable_DLL_USE 动态库补充7
查看>>
全文检索的基本原理
查看>>
CentOS7 安装配置DNS服务器
查看>>
Mongodb 与sql 语句对照
查看>>
tomcat (选号)公司tomcat无页面解决
查看>>
js倒计时
查看>>
ssm下的增删改查和两表分页查询
查看>>
MSP430单片机之中断服务
查看>>
Something about the microsoft HttpContext domain design
查看>>
VS2010平台下的OpenCV、EmguCV( C#)安装、使用配置
查看>>
偷单工具使用教程(非原创)
查看>>
Linux C/C++ 链接选项之静态库--whole-archive,--no-whole-archive和--start-group, --end-group
查看>>
Python基础(三)
查看>>
中文版的mfc类库详解和win32 API大全中文版
查看>>
卡特兰数
查看>>
我对软件发展的思考,一个不变却一直在变的话题
查看>>
Spring Security验证流程剖析及自定义验证方法
查看>>