Posts Categorized: mysql

MySQL Converting ISAM to MyISAM

Some old database tables needed to be converted. This can be done at the mysql command prompt with: ALTER TABLE tbl_name TYPE = MYISAM; Or using the script ‘mysql_convert_table_format’ which is located in the MySQL bin folder. Usage: ./mysql_convert_table_format test –user=root –password=secret be careful as InnoDB tables will also be converted to MyISAM.

MySQL: marked as crashed and should be repaired

I was receiving the following error message in a MySQL database. SQL Error: Table ‘./dbname/tablename’ is marked as crashed and should be repaired So first I tried: REPAIR TABLE `tablename`; However the table was still showing as crashed. Next I tried: mysqlcheck -r -u username -p databasename Which took some time as the database is… Read more »

MySQL Structure Backup

To backup / dump only the structure of a MySQL database (without the data) use the following: mysqldump -u root -p –no-data –all-databases > /var/struct_only.sql

Unix Timestamps and MySQL

Unix timestamps (the number of seconds since Jan 1st 1970) can be converted online at:http://www.unixtimestamp.comSome example dates:26 Feb 2006 19:37 114100066826 Feb 2007 19:37 117253662026 Feb 2008 19:37 120407262012 Aug 2007 12:00 1186934400I had cause to prune some old records from MySQL by unix timestamp, which I did with:USE `emaillog`;DELETE FROM `deliveries` WHERE timestamp<1186934400;19 million… Read more »