Web项目MySQL配置文件运维
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.1Ubuntu16.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"/>

posted on 2017-10-24 14:34 kingstudy 阅读(...) 评论(...) 编辑 收藏

转载于:https://www.cnblogs.com/wxjnew/p/7723390.html

Web项目MySQL配置文件运维相关推荐

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

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

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

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

  3. 「实战篇」开源项目docker化运维部署-后端java部署(七)

    原创文章,欢迎转载.转载请注明:转载自IT人故事会,谢谢! 原文链接地址:「实战篇」开源项目docker化运维部署-后端java部署(七) 本节主要说说后端的部署需要注意的点,本身renren-fas ...

  4. 数据库周刊62丨央企2021年数据库成交公告,国产占90%;流数据库HStreamDB开源;MySQL主从双写导致数据丢失;Oracle 19c升级最佳实践;PG日常工作分享;MySQL MGR运维指

    热门资讯 [1.中央国家机关2021年数据库成交公告:国产数据库份额占90% [摘要]据央采网3月19日发布的<中央国家机关2021年数据库软件协议供货采购项目成交公告>显示事务型数据库管 ...

  5. 老男孩mysql运维dba实战21部完整版_老男孩MySQL DBA 运维课程全套,资源教程下载...

    课程名称 老男孩MySQL DBA 运维课程全套 课程目录 01-第一部-MySQL基础入门(21节) 02-第二部-老男孩MySQL多实例安装与企业应用场景(10节) 03-第三部-老男孩MySQL ...

  6. 华为云服务-微服务部署后的WEB服务日常如何运维

    文章目录 前言 华为云平台下WEB服务日常如何运维 一.主机监控-Agent 步骤一 .AOM控制台 步骤二.Agent管理 步骤三 .安装Agent 步骤四 .Agent管理-查看虚拟机 步骤五.应 ...

  7. mysql 自动化运维工具_MySQL使用工具Inception实现自动化运维

    MySQL使用工具Inception实现自动化运维 发布时间:2020-05-27 17:11:14 来源:51CTO 阅读:180 作者:三月 下面一起来了解下MySQL使用工具Inception实 ...

  8. python实现自动化运维项目_Python自动化运维项目开发最佳实战

    下载地址:五号服务器---VIP资料下载七区\VIP专题教程二区 游客,如果您要查看本帖隐藏内容请回复 Python 自动化运维项目开发最佳实战 这个远比什么老男孩的python好的多 2017-1- ...

  9. java web项目——MySQL中文乱码问题解决

    在我们开发java web项目使用MySQL数据库时,常会遇到中文乱码的问题,比如:使用MySQL命令行查询数据库中的表显示中文乱码:使用jdbc访问数据库读取到中文乱码:在jsp页面显示中出现中文乱 ...

最新文章

  1. JS开发中常用的小技巧
  2. DL之CNN优化技术:学习卷积神经网络CNN的优化、实践经验(练习调参)、从代码深刻认知CNN架构之练习技巧
  3. 对PE文件进行十六进制代码(机器码)提取并保存到外部文件
  4. jeecg 服务器 + linux + nginx 安装
  5. 【实习之T100开发】Genero FGL (TIPTOP4GL) 学习笔记(2)
  6. mysql socket错误处理_Mysql 报错处理
  7. IDEA 使用 学习列表
  8. Laravel 在哪些地方使用了 trait ?
  9. 360服务器安全加固系统,360政企安全
  10. 用RichEditableText做的一个代码编辑器
  11. 希捷7200.11固件门完全DIY修正方法! 不用几块钱, DIYers请进!!!
  12. 创建计划行确认数量为0的销售订单
  13. 基于matlab测量物体直径,基于MATLAB的不规则面积图像测量
  14. 如何测试串口线是否发生故障
  15. JDBC execute常用方法
  16. 前端下载excel文件的两种方法
  17. 语c和c语言,00后黑话等级测试,你能看懂几句?
  18. 如何查看本机Mac地址
  19. sshd_config配置解析
  20. parted 4T磁盘

热门文章

  1. Appium环境的安装与配置,Python测试脚本测试
  2. WCF完美搭建android平台服务之一
  3. 实战:遇到HTM的文件图标丢失的问题
  4. EXCEL_CLASS
  5. 2021 4 21 管理心得
  6. 我不想just talk talk
  7. U3D中可以直接使用GL!!!
  8. go使用之-编译约束
  9. 如何在三年内快速成长为一名技术专家
  10. 代码创建 WPF 旋转动画