Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could no...

问题:维护团队原有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

 

 

转载于:https://www.cnblogs.com/matric/p/8476647.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值