Wednesday 12 June 2013

Mysql Notes1


1. mysql errcode:24

 mysqldump: Couldn't execute 'show fields from `tablename`': Out of resources when opening file './databasename/tablename#P#p125.MYD' (Errcode: 24) (23)

For above kind of problem, you might need to check the ulimit value of system and mysql user.

- login as mysql user: [ sudo -u mysql bash ]
- ulimit -a [ check for the ulimit values ]
- update the /etc/security/limits.conf

If you find the ulimit is less for the mysql user, you can update the same.

# sudo lsof -p <pid_of_mysql> | wc -l  
The above command will let you know how many file is getting used by the mysql process.

mysql> show variables like 'open%';


2. To delete unwanted mysql database partition:

for i in {n1..n2}; do mysql -uroot --pPassword -e "use database_name; alter table tablename_x drop partition p$i;" ;done

In the above base script, n1 and n2 are starting of unwanted mysql database partition number and end of unwanted mysql databse partition number.


To recheck there should not have unwanted mysql table partition:
show create table table_name_x \G



No comments:

Post a Comment