From f98797a0cb4f4c4cb95eda21093e927550452f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E6=8C=AF=E8=AE=AD?= <5552123@qq.com> Date: Fri, 15 Nov 2019 18:20:32 +0800 Subject: [PATCH] mysql --- .gitignore | 3 +- README.md | 10 ++-- conf/mysql/my.cnf | 87 +++++++++++++++++++++++++-------- conf/nginx/conf.d/local.co.conf | 7 +-- 4 files changed, 75 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index d391107..09fca4d 100755 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ *.swp !.gitkeep .DS_Store -.idea \ No newline at end of file +.idea +bak \ No newline at end of file diff --git a/README.md b/README.md index 7a687a0..f2c7e86 100755 --- a/README.md +++ b/README.md @@ -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; @@ -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 结束~ ```` diff --git a/conf/mysql/my.cnf b/conf/mysql/my.cnf index 797f062..20382d1 100755 --- a/conf/mysql/my.cnf +++ b/conf/mysql/my.cnf @@ -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 \ No newline at end of file +[mysqlhotcopy] +interactive-timeout \ No newline at end of file diff --git a/conf/nginx/conf.d/local.co.conf b/conf/nginx/conf.d/local.co.conf index e3b6a3e..5beede7 100755 --- a/conf/nginx/conf.d/local.co.conf +++ b/conf/nginx/conf.d/local.co.conf @@ -14,7 +14,7 @@ server { set $xm $1; } #项目默认目录在public下 - if ($xm ~ (test|dzx|haiyang)){ + if ($xm ~ (test|dzx|dy)){ set $folder ""; } #php5项目 @@ -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;