diff --git "a/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/1.MySQL/MySQL.md" "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/1.MySQL/MySQL.md" index 6b2df0a6..f815a4b3 100644 --- "a/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/1.MySQL/MySQL.md" +++ "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/1.MySQL/MySQL.md" @@ -35,8 +35,10 @@ - 2.19 [删除多余的用户](#删除多余的用户) - 2.20 [创建用户并授权](#创建用户并授权) - 2.21 [为现有的表加字段](#为现有的表加字段) -- 2.2 [一次插入多条记录](#一次插入多条记录) -- 2.2 [](#) +- 2.22 [一次插入多条记录](#一次插入多条记录) +- 2.23 [修改普通用户的密码](#修改普通用户的密码) + + 3. [MySQL约束](#3-mysql-约束) @@ -1301,6 +1303,13 @@ insert into t_category (cname) values ('傻逼游'), ('坑钱游'), ('QNMD游'), ``` +### 修改普通用户的密码 + +``` + +set password for 'doukeyi'@'%' =password('123456a'); + +``` ## 3 mysql 约束 @@ -2298,13 +2307,15 @@ set @@autocommit = 0; ``` +事务的四大特性ACID + +![QQ20191217-204249@2x](images/QQ20191217-204249@2x.png) + ### 自动提交 ### 事务原理 ### 回滚点 ### 事务的隔离级别 - -事务的四大特性ACID - +![QQ20191217-204609@2x](images/QQ20191217-204609@2x.png) ## 9用户管理和权限 diff --git "a/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/1.MySQL/images/QQ20191217-204249@2x.png" "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/1.MySQL/images/QQ20191217-204249@2x.png" new file mode 100644 index 00000000..643bc901 Binary files /dev/null and "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/1.MySQL/images/QQ20191217-204249@2x.png" differ diff --git "a/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/1.MySQL/images/QQ20191217-204609@2x.png" "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/1.MySQL/images/QQ20191217-204609@2x.png" new file mode 100644 index 00000000..b1dcd0b8 Binary files /dev/null and "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/1.MySQL/images/QQ20191217-204609@2x.png" differ diff --git "a/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/2.JDBC/jdbc.md" "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/2.JDBC/jdbc.md" new file mode 100644 index 00000000..fe6dd116 --- /dev/null +++ "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/2.JDBC/jdbc.md" @@ -0,0 +1,91 @@ +# 目录 + + +1. [](#) +- 1.1 + +2. [](#) + +- 2.0 [](#) + - 2.0.1 [ ](#) + - 2.0.1.1 [](#) + - 2.0.1.2 [](#) + + + + + +### 数据库驱动 + +``` + +mysql-connector-java + +https://dev.mysql.com/downloads/connector/j/5.1.html + +``` + + + +### 从 JDBC3 开始,目前已经普遍使用的版本。可以不用注册驱动而直接使用。Class.forName 这句话可以省略。 + +``` + +Class.forName("com.mysql.jdbc.Driver"); + + +``` + + +### JDBC 基本连接 + + +``` + +package com.domanshow.jdbc.demo1; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Properties; + +public class JDBCDemo1Main { + + public static void main(String[] args) throws ClassNotFoundException, SQLException { + + Class.forName("com.mysql.jdbc.Driver"); + + System.out.println("hello JDBC"); + + jdbcCollection2(); + + } + + // 1) 使用用户名、密码、URL得到连接对象 + public static void jdbcCollection1() throws SQLException { + + String url = "jdbc:mysql://65.42.40.36:3306/myutf8"; //1) 使用用户名、密码、URL 得到连接对象 + Connection connection = DriverManager.getConnection(url, "doukeyi", "123456a"); //com.mysql.jdbc.JDBC4Connection@68de145 + System.out.println(connection); + } + + // 2) 使用属性文件和url得到连接对象 + public static void jdbcCollection2() throws SQLException { + + String url = "jdbc:mysql://65.42.40.36:3306/myutf8"; + // 属性对象 + Properties info = new Properties(); + info.setProperty("user", "doukeyi"); + info.setProperty("password", "123456a"); + + Connection connection = DriverManager.getConnection(url, info); + + System.out.println(connection); + } +} + + +``` + + + diff --git "a/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/files/JDBC\347\254\224\350\256\260.pdf" "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/files/JDBC\347\254\224\350\256\260.pdf" new file mode 100755 index 00000000..3900976a Binary files /dev/null and "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/files/JDBC\347\254\224\350\256\260.pdf" differ diff --git "a/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/files/\346\225\260\346\215\256\345\272\223\351\251\261\345\212\250/mysql-connector-java-5.1.48.tar" "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/files/\346\225\260\346\215\256\345\272\223\351\251\261\345\212\250/mysql-connector-java-5.1.48.tar" new file mode 100644 index 00000000..0c1c7432 Binary files /dev/null and "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/files/\346\225\260\346\215\256\345\272\223\351\251\261\345\212\250/mysql-connector-java-5.1.48.tar" differ diff --git "a/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/files/\346\225\260\346\215\256\345\272\223\351\251\261\345\212\250/mysql-connector-java-5.1.48/mysql-connector-java-5.1.48-bin.jar" "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/files/\346\225\260\346\215\256\345\272\223\351\251\261\345\212\250/mysql-connector-java-5.1.48/mysql-connector-java-5.1.48-bin.jar" new file mode 100644 index 00000000..c01f3869 Binary files /dev/null and "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/files/\346\225\260\346\215\256\345\272\223\351\251\261\345\212\250/mysql-connector-java-5.1.48/mysql-connector-java-5.1.48-bin.jar" differ diff --git "a/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/files/\346\225\260\346\215\256\345\272\223\351\251\261\345\212\250/mysql-connector-java-5.1.48/mysql-connector-java-5.1.48.jar" "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/files/\346\225\260\346\215\256\345\272\223\351\251\261\345\212\250/mysql-connector-java-5.1.48/mysql-connector-java-5.1.48.jar" new file mode 100644 index 00000000..fcd53a51 Binary files /dev/null and "b/java/Javaweb2020\351\200\203\350\267\221\350\256\241\345\210\222/files/\346\225\260\346\215\256\345\272\223\351\251\261\345\212\250/mysql-connector-java-5.1.48/mysql-connector-java-5.1.48.jar" differ