Web 应用之数据库的配置 与链接 Mysql

source 绝对路径.sql(绝对路径是对应数据库版本包下的)

source时是有先后顺序的必须是create 在insert 在  

下面是链接,上面是把数据导入到数据库中,数据也可以自己写进去。

配置 properties ->database.properties 的信息:

先说username和password这两个,这是你设置的数据库中的一个数据库管理员,创建语句:

1 grant select, insert, update, delete
2 on onlinebookstore.*
3 to onlinebookstore@localhost identified by '163816';

这就是个普通的sql中的对一个用户赋予权限的语句。每一次进行selct, insert, update, delete等数据库基本操作都要用到这个。所以有时show processlist时如果那个数据库一直显示QUERY时,很有可能就是没有给这个用户赋予权限。

原文地址:https://www.cnblogs.com/chaiwentao/p/4087088.html