Java操作MySQL(JDBC) 数据库

Error:可能无法update,原因是因为sql语句书写不正确,正确的写法见下面(致谢

jdbchttps://dev.mysql.com/downloads/connector/j/

refhttps://www.cnblogs.com/zhangdiIT/p/6772543.html#commentform

Mysql:统计一列中不同值的数量

1.法一:最牛逼的

2.法二:count() 需要提前知道该列中的具体值。

3.法三:sum() 也需要提前知道该列中的具体值

ref:https://www.cnblogs.com/cxxjohnson/p/7966766.html

问题:第一个as后面的别名需要加引号

Mysql常见操作

 

数据库常见errors

1.Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘(2) “

solutionhttps://blog.csdn.net/hjf161105/article/details/78850658

 

2.重置数据库密码

ref:https://www.cnblogs.com/itor/p/6339505.html

3.ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column

 

4.ERROR 1044 (42000): Access denied for user ”@’localhost’ to database ‘mysql’

ref:https://blog.csdn.net/jt_121217/article/details/78247265

5.不能用”key”、”desc”等(Mysql关键字/保留字)做字段名。