Skip to content

Commit

Permalink
mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
duzhenxun committed Nov 15, 2019
1 parent 517dc3d commit f98797a
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
*.swp
!.gitkeep
.DS_Store
.idea
.idea
bak
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,15 @@ duzhenxun/php56
4,mysql:5.7容器
docker run -d --name mysql \
--net ado --ip 10.10.10.31 -p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=123456 \
--net ado --ip 10.10.10.31 -p 23306:3306 \
-e MYSQL_ROOT_PASSWORD=qq5552123 \
-v /data/docker/data/mysql/:/var/lib/mysql/ \
-v /data/docker/logs/mysql/:/var/log/mysql/ \
-v /data/docker/conf/mysql/conf.d/:/etc/mysql/conf.d/ \
-v /data/docker/conf/mysql/my.cnf:/etc/mysql/my.cnf \
mysql:5.7
让其它容器可以连接
docker exec -it mysql bash
mysql -uroot -p123456;
mysql -uroot -pqq5552123;
grant all privileges on *.* to admin@'10.10.%' identified by 'adminadmin' with grant option;
flush privileges;
Expand Down Expand Up @@ -109,6 +107,8 @@ docker stop nginx php php56 mysql redis es es2
7,docker run -d --net ado --ip 10.10.10.101 -p 10022:22 -v /data:/data --name centos1 duzhenxun/centos7
或者
docker run -d --restart=always --name c1 --net ado --ip 10.10.10.101 -p 10022:22 -p 80:80 -p 81:81 -p 888:888 -p 8888:8888 -p 3306:3306 -p 6379:6379 -p 443:443 -v /www:/www duzhenxun/centos7
结束~
````
Expand Down
87 changes: 66 additions & 21 deletions conf/mysql/my.cnf
Original file line number Diff line number Diff line change
@@ -1,32 +1,77 @@
[mysqld]
skip-host-cache
skip-name-resolve

pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /usr/data/mysql
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock

log-error = /var/log/mysql/error.log
[mysqld]
binlog_cache_size = 64K
thread_stack = 256K
join_buffer_size = 1024K
query_cache_type = 1
max_heap_table_size = 64M
port = 3306
socket = /tmp/mysql.sock
datadir = /var/lib/mysql
default_storage_engine = InnoDB
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
performance_schema_max_table_instances = 400
table_definition_cache = 400
skip-external-locking
key_buffer_size = 128M
max_allowed_packet = 100G
table_open_cache = 128
sort_buffer_size = 768K
net_buffer_length = 4K
read_buffer_size = 768K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 16M
thread_cache_size = 64
query_cache_size = 64M
tmp_table_size = 64M
sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

slow_query_log
long_query_time = 1
slow-query-log-file = /var/log/mysql/slow.log
explicit_defaults_for_timestamp = true
#skip-name-resolve
max_connections = 100
max_connect_errors = 100
open_files_limit = 65535

server-id=1
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
expire_logs_days = 10
slow_query_log=1
slow-query-log-file=/var/lib/mysql/mysql-slow.log
long_query_time=3
#log_queries_not_using_indexes=on
early-plugin-load = ""

default-storage-engine = InnoDB
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

innodb_data_home_dir = /var/lib/mysql
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql
innodb_buffer_pool_size = 256M
innodb_log_file_size = 128M
innodb_log_buffer_size = 32M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_max_dirty_pages_pct = 90
innodb_read_io_threads = 2
innodb_write_io_threads = 2

[mysqldump]
quick
quote-names
max_allowed_packet = 16M


max_allowed_packet = 500M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer_size = 64M
sort_buffer_size = 1M
read_buffer = 2M
write_buffer = 2M

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqlhotcopy]
interactive-timeout
7 changes: 2 additions & 5 deletions conf/nginx/conf.d/local.co.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ server {
set $xm $1;
}
#项目默认目录在public下
if ($xm ~ (test|dzx|haiyang)){
if ($xm ~ (test|dzx|dy)){
set $folder "";
}
#php5项目
Expand All @@ -23,16 +23,13 @@ server {
}
root "/data/wwwroot/$xm/$folder";

if ( !-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}

location / {
index index.php;
autoindex off;
#laravel 配置,thinkphp配置
try_files $uri $uri/ /index.php?$query_string;

}
location ~ \.php(.*)$ {
fastcgi_pass $xmphpip;
Expand Down

0 comments on commit f98797a

Please sign in to comment.