Problema com conexão no BD.[RESOLVIDO]

Pessoal, tenho o mysql e um sistema Java que deve se conectar a uma base de dados no mysql mas o sistema não esta conseguindo se conectar com o BD.

Da esse erro:


java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:935)
	at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4101)
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1300)
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2337)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2370)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
	at java.sql.DriverManager.getConnection(DriverManager.java:620)
	at java.sql.DriverManager.getConnection(DriverManager.java:200)
	at com.eduardokraus.db.SqlConnection.getConnection(SqlConnection.java:22)
	at com.eduardokraus.vo.Usuario.login(Usuario.java:46)
	at com.eduardokraus.Application.appConnect(Application.java:17)
	at org.red5.server.adapter.MultiThreadedApplicationAdapter.connect(MultiThreadedApplicationAdapter.java:337)
	at org.red5.server.Scope.connect(Scope.java:329)
	at org.red5.server.Scope.connect(Scope.java:326)
	at org.red5.server.BaseConnection.connect(BaseConnection.java:303)
	at org.red5.server.net.rtmp.RTMPConnection.connect(RTMPConnection.java:270)
	at org.red5.server.net.rtmp.RTMPMinaConnection.connect(RTMPMinaConnection.java:97)
	at org.red5.server.net.rtmp.RTMPHandler.onInvoke(RTMPHandler.java:285)
	at org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:138)
	at org.red5.server.net.rtmp.RTMPMinaIoHandler.messageReceived(RTMPMinaIoHandler.java:180)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:716)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
	at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:423)
	at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:245)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
	at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:715)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$500(AbstractPollingIoProcessor.java:64)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1117)
	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:636)
java.lang.NullPointerException
	at com.eduardokraus.vo.Usuario.login(Usuario.java:46)
	at com.eduardokraus.Application.appConnect(Application.java:17)
	at org.red5.server.adapter.MultiThreadedApplicationAdapter.connect(MultiThreadedApplicationAdapter.java:337)
	at org.red5.server.Scope.connect(Scope.java:329)
	at org.red5.server.Scope.connect(Scope.java:326)
	at org.red5.server.BaseConnection.connect(BaseConnection.java:303)
	at org.red5.server.net.rtmp.RTMPConnection.connect(RTMPConnection.java:270)
	at org.red5.server.net.rtmp.RTMPMinaConnection.connect(RTMPMinaConnection.java:97)
	at org.red5.server.net.rtmp.RTMPHandler.onInvoke(RTMPHandler.java:285)
	at org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:138)
	at org.red5.server.net.rtmp.RTMPMinaIoHandler.messageReceived(RTMPMinaIoHandler.java:180)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:716)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
	at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:423)
	at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:245)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
	at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:715)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$500(AbstractPollingIoProcessor.java:64)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1117)
	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:636)
[WARN] [NioProcessor-1] org.red5.server.net.rtmp.RTMPConnection - Client rejected, unscheduling waitForHandshakeJob
org.red5.server.exception.ClientRejectedException: Client rejected
	at org.red5.server.adapter.MultiThreadedApplicationAdapter.rejectClient(MultiThreadedApplicationAdapter.java:292) [red5.jar:na]
	at com.eduardokraus.Application.appConnect(Application.java:21) [na:na]
	at org.red5.server.adapter.MultiThreadedApplicationAdapter.connect(MultiThreadedApplicationAdapter.java:337) [red5.jar:na]
	at org.red5.server.Scope.connect(Scope.java:329) [red5.jar:na]
	at org.red5.server.Scope.connect(Scope.java:326) [red5.jar:na]
	at org.red5.server.BaseConnection.connect(BaseConnection.java:303) [red5.jar:na]
	at org.red5.server.net.rtmp.RTMPConnection.connect(RTMPConnection.java:270) [red5.jar:na]
	at org.red5.server.net.rtmp.RTMPMinaConnection.connect(RTMPMinaConnection.java:97) [red5.jar:na]
	at org.red5.server.net.rtmp.RTMPHandler.onInvoke(RTMPHandler.java:285) [red5.jar:na]
	at org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:138) [red5.jar:na]
	at org.red5.server.net.rtmp.RTMPMinaIoHandler.messageReceived(RTMPMinaIoHandler.java:180) [red5.jar:na]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:716) [mina2-core.jar:na]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434) [mina2-core.jar:na]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46) [mina2-core.jar:na]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796) [mina2-core.jar:na]
	at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:423) [mina2-core.jar:na]
	at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:245) [mina2-core.jar:na]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434) [mina2-core.jar:na]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46) [mina2-core.jar:na]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796) [mina2-core.jar:na]
	at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119) [mina2-core.jar:na]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434) [mina2-core.jar:na]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426) [mina2-core.jar:na]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:715) [mina2-core.jar:na]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668) [mina2-core.jar:na]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657) [mina2-core.jar:na]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$500(AbstractPollingIoProcessor.java:64) [mina2-core.jar:na]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1117) [mina2-core.jar:na]
	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) [mina2-core.jar:na]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.6.0_18]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.6.0_18]
	at java.lang.Thread.run(Thread.java:636) [na:1.6.0_18]

E a classe de conexao tem esse codigo:


import java.sql.Connection;
import java.sql.DriverManager;

public class SqlConnection {

	private static Connection conn = null;

	public static Connection getConnection() {
		
		try {
			Class.forName("com.mysql.jdbc.Driver");
			conn = DriverManager.getConnection("jdbc:mysql://192.168.0.149/multi_conferencia", "root", "123");
			System.out.println(conn != null);						
		} catch (Exception e) {
			System.out.println("Erro de Conexão! " + e.getMessage());
		}
		return conn;
		
		/*String url = "jdbc:mysql://localhost:3306/multi_conferencia";
		String user = "root";
		String pass = "";
		
		if (conn == null) {
			try {
				Class.forName("com.mysql.jdbc.Driver");
			} catch (ClassNotFoundException e) {
				e.printStackTrace();
			}
			try {
				conn = DriverManager.getConnection(url, user, pass);
				System.out.println("CONAXAO BD!");
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return conn;*/
	}
}

Os dados do ip, base de dados, usuario e senha estão corretos, o que pode ser ??

Valeu!

No banco você tem que dar acesso ao root para o servidor onde está a aplicação. Pelo menos é isso o que a mensagem de erro indica fazer.

E como que faz isso ?!?!

Fui tenta faze com uns comando que achei na net e ferrei com o BD, tive que reinstala ele hsauhsau!

Valeu!

Resolvi o problema!
Esse codigo java é de um sistema que fiz para Red5 e no meu projeto no Red5 tinha dois arquivos jar que eu criei, um chamado sistema3.jar e outro que era um bkp chamado sistema3–.jar. Não sei pq o arquivo de bkp tava dando esse problema, foi só excluir ele que funcionou!

Flw!