Answers for "java.sql.SQLSyntaxErrorException: Access denied for user 'user'@'%' to database 'app'"

SQL
1

java.sql.sqlexception: access denied for user

You have to grant priviliges to root@localhost
e.g 
GRANT ALL PRIVILIGES ON *.* TO 'root'@'localhost' IDENTIFIED BY password

(*.*: means everything, it can be modified to some specific DB or opertations)
Posted by: Guest on September-20-2021
0

java.sql.sqlexception: access denied for user

As you are creating a database from scratch, you could use:

Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/?user=root&password=rootpassword"); 
PreparedStatement ps = connection.prepareStatement("CREATE DATABASE databasename");
int result = ps.executeUpdate();
Posted by: Guest on August-11-2021

Code answers related to "java.sql.SQLSyntaxErrorException: Access denied for user 'user'@'%' to database 'app'"

Code answers related to "SQL"

Browse Popular Code Answers by Language