牛刀小试mysql-凯发app官方网站

凯发app官方网站-凯发k8官网下载客户端中心 | | 凯发app官方网站-凯发k8官网下载客户端中心
  • 博客访问: 1931822
  • 博文数量: 176
  • 博客积分: 1857
  • 博客等级: 上尉
  • 技术积分: 2729
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-14 22:55
个人简介

吾生有涯,而知无涯,适当止学.循序渐进,步步提升 talk is cheap, show me the code.

文章分类

全部博文(176)

文章存档

2019年(1)

2018年(14)

2017年(20)

2016年(31)

2015年(15)

2014年(5)

2013年(10)

2012年(80)

相关博文
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·

分类: mysql/postgresql

2018-05-16 15:48:51

*查看linux的版本
[root@mysql etc]# cat /etc/redhat-release
centos linux release 7.3.1611 (core)

*前置条件,安装gcc和gcc-c
yum -y install gcc gcc-c

* could not find curses
yum install ncurses-devel

* bison executable not found in path
yum install bison

1) cmake的源编译安装
[root@db software]# nohup tar zxvf cmake-3.11.1.tar.gz &
[root@db software]# cd cmake-3.11.1
[root@db cmake-3.11.1]# ./configure
[root@localhost cmake-3.0.1]# gmake && make install 

2) wolfssl包的部署安装[可选项]
*. 从wolfssl.com网站下载wolfssl-3.13.0.zip压缩包
*. 解压至/data/software/mysql-8.0.11/extra/wolfssl-3.13.0目录中。
*. cd extra/wolfssl-3.13.0/ide/mysql
*. 执行do.sh脚本
*. use -dwith_ssl=wolfssl for cmake

3) openssl和openssl-devel[本实验使用的是system ssl]
yum install –y openssl openssl-devel 

4)mysql的编译安装
[root@mysql software]#tar zxvf mysql-8.0.11.tar.gz
[root@mysql software]# cd mysql-8.0.11/
[root@mysql software]# mkdir zdebug
[root@mysql software]# cd zdebug

cmake .. -dcmake_install_prefix=/usr/local/mysql \
-ddefault_charset=utf8 \
-ddefault_collation=utf8_general_ci \
-denabled_local_infile=on \
-dwith_innodb_memcached=on \
-dwith_ssl=system \
-dwith_innobase_storage_engine=1 \
-dwith_federated_storage_engine=1 \
-dwith_blackhole_storage_engine=1 \
-dwith_archive_storage_engine=1 \
-dwithout_example_storage_engine=1 \
-dwith_perfschema_storage_engine=1 \
-dcompilation_comment="zsd edition" \
-ddownload_boost=1 \
-dwith_boost=/tmp \
-dmysql_unix_addr=/data/mysqldata/3306/mysql.sock \
-dsysconfdir=/data/mysqldata/3306 > /data/software/mysql-8.0.11/zdebug/mysql_cmake80.log 2>&1

出现下列日志:
............
-- configuring done
-- generating done
-- build files have been written to: /data/software/mysql-8.0.11/zdebug
............
其中:-dwith_ssl=system 走的是操作系统linux的openssl,需要安装openssl和openssl-devel包,才可以被包括编译

//-j 12参数,通过使用12个线程加速编译,让编译时间近可能快一点
make -j 12
make install

--------------------------------------------mysql 8.0的软件目录结构----------------------------------------
[root@mysql zdebug]# cd /usr/local/mysql/
[root@mysql mysql]# ls -l 
total 612
drwxr-xr-x.  2 root root   4096 may 16 14:20 bin
drwxr-xr-x.  2 root root     55 may 16 14:20 docs
drwxr-xr-x.  3 root root    266 may 16 14:20 include
drwxr-xr-x.  4 root root    173 may 16 14:20 lib
-rw-r--r--.  1 root root 301518 apr  8 14:44 license
-rw-r--r--.  1 root root 301518 apr  8 14:44 license-test
drwxr-xr-x.  4 root root     30 may 16 14:20 man
drwxr-xr-x. 10 root root   4096 may 16 14:21 mysql-test
-rw-r--r--.  1 root root    687 apr  8 14:44 readme
-rw-r--r--.  1 root root    687 apr  8 14:44 readme-test
drwxr-xr-x. 28 root root   4096 may 16 14:21 share
drwxr-xr-x.  2 root root     90 may 16 14:21 support-files

5)创建mysql用户&并修改相关文件

[root@mysql mysql]# groupadd mysql 
[root@mysql mysql]# useradd -g mysql mysql

6)设置用户操作系统资源的限制 
[root@localhost cmake-3.0.1]# vi /etc/security/limits.conf 
mysql soft nproc 65536 
mysql hard nproc 65536 
mysql soft nofile 65536 
mysql hard nofile 65536

验证limit是否生效 
[root@mysql ~]# su - mysql 
[mysql@mysql ~]$ ulimit -a

日志如下:
............
open files                      (-n) 65536
max user processes              (-u) 65536
...........
(7)创建mysql数据目录及赋予相应权限
#cd /data/ 
#mkdir -p /data/mysqldata/{3306/{data,tmp,binlog,innodb_ts,innodb_log},backup,scripts} 
#chown -r mysql:mysql mysqldata 
#su - mysql 

(8)配置my.cnf文件
$vi /data/mysqldata/3306/my.cnf 

[client]
port = 3306
socket = /data/mysqldata/3306/mysql.sock
# the mysql server
[mysqld]
port = 3306
user = mysql
socket = /data/mysqldata/3306/mysql.sock
pid-file = /data/mysqldata/3306/mysql.pid
basedir = /usr/local/mysql
datadir = /data/mysqldata/3306/data
tmpdir = /data/mysqldata/3306/tmp
open_files_limit = 60000
explicit_defaults_for_timestamp
server-id = 1203306
lower_case_table_names = 1
character-set-server = utf8
federated
#sql_mode=strict_trans_tables
max_connections = 1000
max_connect_errors = 100000
interactive_timeout = 86400
wait_timeout = 86400
sync_binlog=0
back_log=100
default-storage-engine = innodb
log_slave_updates = 1
#*********** logs related settings ***********
log-bin = /data/mysqldata/3306/binlog/mysql-bin
binlog_format= mixed
binlog_cache_size=32m
max_binlog_cache_size=64m
max_binlog_size=512m
long_query_time = 1
log_output = file
log-error = /data/mysqldata/3306/mysql-error.log
slow_query_log = 1
slow_query_log_file = /data/mysqldata/3306/slow_statement.log
#log_queries_not_using_indexes
general_log = 0
general_log_file = /data/mysqldata/3306/general_statement.log
#expire-logs-days = 14
binlog_expire_logs_seconds = 1728000
relay-log = /data/mysqldata/3306/binlog/relay-bin
relay-log-index = /data/mysqldata/3306/binlog/relay-bin.index
#****** mysql replication new feature********* 
master-info-repository=table
relay-log-info-repository=table
relay-log-recovery
#*********** innodb specific options *********** 
innodb_buffer_pool_size = 2048m
transaction-isolation=repeatable-read
innodb_buffer_pool_instances = 8
innodb_file_per_table = 1
innodb_data_home_dir = /data/mysqldata/3306/innodb_ts
innodb_data_file_path = ibdata1:2048m:autoextend
innodb_thread_concurrency = 8
innodb_log_buffer_size = 16m
innodb_log_file_size = 128m
innodb_log_files_in_group = 3
innodb_log_group_home_dir = /data/mysqldata/3306/innodb_log
innodb_flush_log_at_trx_commit = 2
innodb_max_dirty_pages_pct = 70
innodb_flush_method=o_direct
[mysql]
no-auto-rehash
default-character-set=gbk
prompt = (\u@\h) [\d]>\_

(9)初始化mysql数据库
$/usr/local/mysql/bin/mysqld --defaults-file=/data/mysqldata/3306/my.cnf --initialize --user=mysql

(10)启动mysql服务
$/usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysqldata/3306/my.cnf --user=mysql &

(11)登陆数据库
备注:密码来自于error log日志,明细如下:
................
2018-05-16t07:17:57.335486z 5 [note] [my-010454] [server] a temporary password is generated for root@localhost: j ................
$/usr/local/mysql/bin/mysql -uroot -p'j (12)数据库一些基本权限配置
*.修改root账号密码:
alter user 'root'@'localhost' identified with sha256_password by 'zsd@7101' password expire interval 360 day;

*.查看目前的用户账号
(root@localhost) [(none)]> select user,host from mysql.user; 
------------------ -----------
| user             | host      |
------------------ -----------
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
------------------ -----------
4 rows in set (0.00 sec)
阅读(2465) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
")); function link(t){ var href= $(t).attr('href'); href ="?url=" encodeuricomponent(location.href); $(t).attr('href',href); //setcookie("returnouturl", location.href, 60, "/"); }
网站地图