MySQL: Install locally (not as root) from binaries

Under Ubuntu, I have tried to setup MySQL from binaries for a local user (not root) with another MySQL instance already running. This works, but is documented rather vaguely (I did not find anything that documented the whole process). So I will sum up the solution I have come up with here: download a MySQL Continue reading →

MySQL 5.5 vs 5.6: ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

I was building an index which was too long using MySQL 5.5. MySQL returned a WARNING 1071 (42000): Specified key was too long; max key length is 767 bytesWARNING 1071 (42000): Specified key was too long; max key length is 767 bytes The index got silently truncated. And, at least on the surface, everything worked. Continue reading →

MyBatis, MySQL and Zero Dates

I was using MyBatis together with MySQL, now I kept getting something like 13:42:32.681 [main] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource Exception in thread "main" org.springframework.dao.TransientDataAccessResourceException: ### Error querying database. Cause: java.sql.SQLException: Value ' 6181070861^L39078830@N04^S0000-00-00 00:00:00 13.371369 52.515972^@^@' can not be represented as java.sql.Timestamp ### The error may exist in de/uniwue/dmir/flickr/db/mapper/FlickrMapper.java (best guess) Continue reading →

How to reset MySQL passwords.

Obviously this only works if you have direct access to the MySQL-Servers startup routine. This link describes what you need to do: http://dev.mysql.com/doc/refman/5.1/de/resetting-permissions.html Essentially this is what you do. It is the unsafe yet fastest way. Kill mysqld start mysql by mysqld --skip-grant-tables --user=root (Windows-Users skip --user=root). Connect to the mysqld-server using: shell> mysql -u Continue reading →

MySQL: How te get last autoincrenment id.

There are three ways using java: http://dev.mysql.com/doc/refman/6.0/en/connector-j-usagenotes-basic.html#connector-j-examples-autoincrement-getgeneratedkeys This is the one I prefere, because the value is scoped by the Statment instance, hence only overwritten when I reuse the specific Statement: Statement stmt = null; ResultSet rs = null;   try {   // // Create a Statement instance that we can use for // Continue reading →