2013年8月12日 星期一

mysql trouble shoot

Can not issue data manipulation statements with executeQuery()

statement.executeUpdate("INSERT INTO Sessions(id_user) VALUES(1)"); // DML operation
statement.executeQuery("SELECT LAST_INSERT_ID()"); // SELECT operation



java.lang.ClassNotFoundException:com.mysql.jdbc.Driver

You can download the latest mysql driver jar from below path, and copy to your classpath or if you are using web server then copy to tomcat/lib or war/web-inf/lib folder.

http://dev.mysql.com/downloads/connector/j/ or

http://mirrors.ibiblio.org/pub/mirrors/maven2/mysql/mysql-connector-java/5.1.10/mysql-connector-java-5.1.10.jar

Copyed the *.jar into my WEB-INF/lib folder -> Worked for me. When including over buildpath there was everytime this errormsg.

MySQL Error number 2003


mysql error Number 2003
my.cnf problem bind on 127.0.0.1 should :
bind-address            = 192.168.0.5

using password: NO / using password: YES

#mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

root@it-dev:~# mysql -uroot -proot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

it happen when
1. it it new install mysql
2. use root to login,

when use user to login, it it ok.
$ mysql
$ mysql -uroot@localhost
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 63
Server version: 5.5.29-0ubuntu0.12.04.1 (Ubuntu)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Create Root password in mysql
now set the root password.
SET PASSWORD FOR 'root' @ 'localhost' = password('root');


沒有留言:

張貼留言