Labels

Showing posts with label DATABASE. Show all posts
Showing posts with label DATABASE. Show all posts

Monday, 14 April 2014

[MYSQL] #1045 error And reset password

iff you actually have set a root password and you've just lost/forgotten it:
  1. Stop MySQL: sudo /etc/init.d/mysql start or mysql start
  2. Restart it manually with the skip-grant-tables option:  mysqld_safe --skip-grant-tables
  3. Run the MySQL client: mysql -u root
  4. Reset the root password manually with this MySQL command: UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
  5. Flush the privileges with this MySQL command: FLUSH PRIVILEGES;
From http://www.tech-faq.com/reset-mysql-password.shtml
(Maybe this isn't what you need, Abs, but I figure it could be useful for people stumbling across this question in the future)

source:  http://stackoverflow.com/questions/489119/mysql-error-1045-access-denied

Wednesday, 27 November 2013

[POSTGRES] PSQLException: The column index is out of range: 1, number of columns: 0

I tried to write a insert statement with Spring JDB Template for an PostgreSQL Database. My insert string looked like this:

final String sql = "INSERT INTO products (prod_name, prod_key, artifact_id, 
group_id, link, src, prod_type) VALUES ('?','?','?','?','?','?','?')";

And I got this Exception:
PreparedStatementCallback; SQL []; The column index is out of range: 1,
 number of columns: 0.; nested exception is org.postgresql.util.PSQLException: 
The column index is out of range: 1, number of columns: 0.

Solve:
The Problem was that I used ” ‘ ” inside of the sql string close to the “?”. After I removed the ” ‘ ” strings it worked perfectly.