Reputation: 625
I have imported
scala> import java.sql._
scala> Class.forName("com.mysql.jdbc.Driver")
Next step is to connect to database server
scala> val connection = DriverManager.getConnection(
"jdbc:mysql://127.0.0.1:3306/test",
"milenko", // username when connecting
"papai" // password)
But problems occured with
java.sql.SQLException: Access denied for user 'milenko'@'localhost'
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3835)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3771)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:870)
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1659)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1206)
My connections
netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:31416 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
Any ideas?
Upvotes: 0
Views: 206
Reputation: 26
using localhost the coonection works. msebaapc:bin sebaacomtx$ ./mysql -u root -p mysql-admin -h localhost -P 3306 Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 97 Server version: 5.6.15 MySQL Community Server (GPL)
Upvotes: 1