Archive for the ‘MySQL’ Category

Recently I got an liquibase error while deploying my application on tomcat.

Waiting for changelog lock....
Waiting for changelog lock....
Waiting for changelog lock....
Waiting for changelog lock....
Waiting for changelog lock....
Waiting for changelog lock....
Waiting for changelog lock....
Liquibase Update Failed: Could not acquire change log lock. 

The root cause was that some changesets with some sql statements took a very long time for execution and was accidentaly aborted. Then on the next time when liquibase was to execute the same changesets, the previous lock was held.

Lockdata is stored in the table DATABASECHANGELOCK. To get rid of the lock you just change 1 to 0 or drop that table and recreate.

update DATABASECHANGELOGLOCK set LOCKED=false, LOCKGRANTED=null, LOCKEDBY=null where ID=1;

 

Advertisements

Recently, i got the following error while trying to drop a schema. After few minutes of searching, i found a solution for this which I would like to share with you all.

Root Cause: The DROP DATABASE statement will remove all table files and then remove the directory that represented the database. It will not, however, remove non-table files, whereby making it not possible to remove the directory.

Solution : We have to drop the database manually by removing any remaining files in the database directory and then the directory itself.

Go to the datadir for your mysql installation and rm the databases manually.

$ cd /usr/local/var/mysql
$ ls (you can find your schema as a folder here)
$ sudo rm -r suhasjavablogSchema // Force schema drop from here.

Sometimes you gets the following error while trying start mysql server

root@server [~]# mysql
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
root@server [~]# /etc/init.d/mysql status
ERROR! MySQL is not running, but lock exists

Please run the following commands to resolve it.

root@server [~]# ps -elf|grep mysql

Force kill any mysql process, if present.

root@server [~]# rm /var/lock/subsys/mysql
rm: remove regular empty file `/var/lock/subsys/mysql’? y

Start the mysql server now. You problem must be resolved by now. 🙂

root@server [~]# /etc/init.d/mysql start