码迷,mamicode.com
首页 > 数据库 > 详细

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection

时间:2018-02-27 01:12:52      阅读:312      评论:0      收藏:0      [点我收藏+]

标签:rac   ann   有关   end   term   terminal   compute   ogg   错误信息   

问题:维护团队原有java项目,spring + mybatis。所在机器重启后,重启项目,tomcat已启动,报以下错

技术分享图片

解决:

根据错误信息推测与数据库有关,在Linux上执行mysql,报错

which mysql
sh xx/bin/mysqld_safe   # xx为安装地址

执行mysql无问题,项目仍报错。mysql语句链接项目使用数据库,报错;链接另一个一直数据库,可链接

进入项目所在目录下使用的mysql文件夹,执行sh xx/bin/mysqld_safe

梳理:

mysql作为基本环境,使用环境都已安装,上学学习数据库相关也遗忘,梳理之。

[mysql 和 mysqld]

 mysql (sometimes referred to as the terminal monitor” or just monitor”) is an interactive program that enables you to connect to a MySQL server, run queries, and view the results. mysql may also be used in batch mode: you place your queries in a file beforehand, then tell mysql to execute the contents of the file. Both ways of using mysql are covered here. 简单理解mysql为一条语句

mysqld, also known as MySQL Server, is the main program that does most of the work in a MySQL installation. MySQL Server manages access to the MySQL data directory that contains databases and tables. The data directory is also the default location for other information such as log files and status files.mysqld 为后台server,所有client都需要通过mysqld去连接

mysqld_safe is the recommended way to start a mysqld server on Unix. mysqld_safe adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log. 启动mysqld的脚本,读取的是对应目录下的etc/my.cof

【cannot connect】

A MySQL client on Unix can connect to the mysqld server in two different ways: By using a Unix socket file to connect through a file in the file system (default /tmp/mysql.sock), or by using TCP/IP, which connects through a port number. A Unix socket file connection is faster than TCP/IP, but can be used only when connecting to a server on the same computer. A Unix socket file is used if you do not specify a host name or if you specify the special host name localhost.

技术分享图片

 

https://dev.mysql.com/doc/refman/5.7/en/can-not-connect-to-server.html

 

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection

标签:rac   ann   有关   end   term   terminal   compute   ogg   错误信息   

原文地址:https://www.cnblogs.com/matric/p/8476647.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!