root@mysqltest:/etc/mysql/mysql.conf.d# cat mysqld.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html # This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location. # Here is entries for some specific programs
# The following values assume you have at least 32M ram [mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0 [mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
interactive_timeout = 9504000
wait_timeout = 9504000
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
lower_case_table_names=1
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
root@mysqltest:/etc/mysql/mysql.conf.d#

需要特别注意的是:

interactive_timeout = 9504000
wait_timeout = 9504000
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
lower_case_table_names=1
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M

如果需要远程访问,需要注释掉

# bind-address		= 127.0.0.1
Ubuntu16.0.4中MySQL的配置文件存在于/etc/mysql/mysql.conf.d/mysqld.cnf

root@mysqltest:/etc/mysql/mysql.conf.d# pwd
/etc/mysql/mysql.conf.d
root@mysqltest:/etc/mysql/mysql.conf.d# ll
total 16
drwxr-xr-x 2 root root 4096 Oct 24 10:51 ./
drwxr-xr-x 4 root root 4096 Sep 22 15:40 ../
-rw-r--r-- 1 root root 3115 Oct 24 10:51 mysqld.cnf
-rw-r--r-- 1 root root 21 Feb 4 2017 mysqld_safe_syslog.cnf

另外java项目配置hibernate的时候加上自动重连的参数

hibernate.connection.url=jdbc:mysql://ip:3306/ucom?characterEncoding=utf8&autoReconnect=true

如果是xml,&符号需要&进行转义

<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="80" maxIdle="30" maxWait="1000" name="ucomdb" password="gdyl2017" type="javax.sql.DataSource" url="jdbc:mysql://ip:3306/ucom?characterEncoding=utf8&amp;autoReconnect=true" username="root"/>

Web项目MySQL配置文件运维的更多相关文章

  1. 部署MySQL自动化运维工具inception+archer

    ***************************************************************************部署MySQL自动化运维工具inception+a ...

  2. 有赞MySQL自动化运维之路—ZanDB

      有赞MySQL自动化运维之路—ZanDB 一.前言 在互联网时代,业务规模常常出现爆发式的增长.快速的实例交付,数据库优化以及备份管理等任务都对DBA产生了更高的要求,单纯的凭借记忆力去管理那几十 ...

  3. C# 动态创建SQL数据库(二) 在.net core web项目中生成二维码 后台Post/Get 请求接口 方式 WebForm 页面ajax 请求后台页面 方法 实现输入框小数多 自动进位展示,编辑时实际值不变 快速掌握Gif动态图实现代码 C#处理和对接HTTP接口请求

    C# 动态创建SQL数据库(二) 使用Entity Framework  创建数据库与表 前面文章有说到使用SQL语句动态创建数据库与数据表,这次直接使用Entriy Framwork 的ORM对象关 ...

  4. 书籍推荐系列之一 -- 《凤凰项目:一个IT运维的传奇故事》

    博客已经完全更新了名字,新的名字,新的开始,想让自走向新的道路是很难的,走出舒适圈说了好久,也是时候开始行动了,今天就从写博客开始. 今天给大家推荐一本书,<凤凰项目:一个IT运维的传奇故事&g ...

  5. MySQL数据库运维课程

    MySQL数据库运维课程 http://www.dataguru.cn/article-4834-1.html?union_site=comm100 课程大纲 第一课:机器选型.系统规划 第二课:安装 ...

  6. centos6.5环境下的web项目mysql编码方式导致的中文乱码问题

    最近在centos6.5下部署web项目时网页出现中文乱码的问题,在排除掉php之后,把问题锁定在mysql的编码方式上. 解决方法如下: 首先进入mysql命令行,输入命令:SHOW VARIABL ...

  7. Inception介绍(MySQL自动化运维工具)

    Inception介绍 GitHub:https://github.com/mysql-inception/inception 文档:https://mysql-inception.github.io ...

  8. MySQL数据库运维的五大指标

    如何评价一个公司数据库运维水平的高低?用什么来进行横向与纵向对比?自动化平台建设的目标是什么?必须有相应的指标体系来指导,此指标体系必须满足以下条件: • 可以用数字来测算和衡量 • 最终指标,而不是 ...

  9. mysql日常运维与参数调优

    日常运维 DBA运维工作 日常 导数据,数据修改,表结构变更 加权限,问题处理 其它 数据库选型部署,设计,监控,备份,优化等 日常运维工作: 导数据及注意事项 数据修改及注意事项 表结构变更及注意事 ...

随机推荐

  1. IMG镜像写盘工具physdiskwrite,用于MikroTik RouterOS的安装(Windows)

    常用img的备份: 1.linux下使用dd,Windows下使用WinImage 2.或者还有很多,比如再生龙等等. img还原: 1.Win32DiskImager 2.physdiskwrite ...

  2. 使用CefSharp在.Net程序中嵌入Chrome浏览器(六)——调试

    chrome强大的调试功能令许多开发者爱不释手,在使用cef的时候,我们也可以继承这强大的开发者工具. 集成调试: 我们可以使用如下函数直接使用集成在chrome里的开发者工具 _chrome.Sho ...

  3. 关于STM32 SPI NSS的讨论

    NSS分为内部引脚和外部引脚. NSS外部引脚可以作为输入信号或者输出信号, 输入信号一般用作硬件方式从机的片选, 而输出信号一般用于主SPI去片选与之相连的从SPI. NSS从设备选择有两种模式: ...

  4. springboot中配置druid允许一次执行多条sql

    原文:https://blog.csdn.net/jiangjun0130/article/details/77868578 1:在配置文件中不需要指定wall防火墙filter. 配置如下: spr ...

  5. 【ELK】5.spring boot日志集成ELK,搭建日志系统

    阅读前必看: ELK在docker下搭建步骤 spring boot集成es,CRUD操作完整版 ============================================== 本章集成 ...

  6. 从零開始学android&lt;使用嵌套布局实现计算器界面.十七.&gt;

    所谓的嵌套布局就是在一个文件里嵌套多个布局文件 <span style="font-size:18px;"> <LinearLayout android:layo ...

  7. 树莓派2B安装Xware迅雷远程下载

    转自:http://www.cnblogs.com/liangjh/articles/5347811.html 一.安装使用迅雷Xware (1)下载Xware1.0.31_armel_v5te_gl ...

  8. 教你摆脱低级程序猿 项目中cocopads的安装使用

    小农今天聊聊一款作为iOS开发者必备的第三方管理软件.希望程序猿朋友们看到小农的这篇文章后.可以真正的学会怎样灵活管理你项目中的第三方. (一)CocoaPods是什么? 首先我们来认识一下这款第三方 ...

  9. [Web 前端] 如何在React中做Ajax 请求?

    cp from : https://segmentfault.com/a/1190000007564792 如何在React中做Ajax 请求? 首先:React本身没有独有的获取数据的方式.实际上, ...

  10. jQuery.data() 的实现方式,jQuery16018518865841457738的由来,jQuery后边一串数字的由来

    原文地址: http://xxing22657-yahoo-com-cn.iteye.com/blog/1042440 jQuery.data() 的实现方式 jQuery.data() 的作用是为普 ...