Mysql Connection with out password using corejava program

后端 未结 8 1312
你的背包
你的背包 2020-12-07 03:21

I want to connect to a MySQL database. While installing MySQL I did not give any password, so in my program I did the same but I am getting error on connection. I am using p

8条回答
  •  一生所求
    2020-12-07 03:49

    According to you, you are passing username as root and password as empty string.And your connection is established through

    con=DriverManager.getConnection("jdbc:mysql://localhost:3306/easylibdb1","root","");
    

    So change your function as

    con=DriverManager.getConnection("jdbc:mysql://localhost:3306/easylibdb1","root",null);
    

    Then it will work. Or change the password in the application.properties file as

    password=
    

提交回复
热议问题