Ramblings from MostlyChris

Tech stuff and a bit more

Browsing Posts in mysql

I usually just take a look at the users' table in mysql to determine what users have access to databases and from what hosts. I ran across this nifty command today that will print it all out nicely in an ssh shell. mysql -u root -B -N -p -e "SELECT user, host FROM user" mysql

I recently ran across a replication error in mysql that looks a bit like the following: Error: 'Incorrect information in file… … .frm on query' If you run the command: mysql -e 'show engines' You will see that the InnoDB engine is DISABLED. Since mysql ships with InnoDB enabled by default, this is a strange [...]

I needed dump some data from a restored ibdata file on a production server. In order to do this, a second instance of mysql was started with a separate data directory. Here are the steps to make it happen. 1. Create a new data directory. mkdir /var/lib/mysql2 2. Install the base mysql server files. mysql_install_db [...]

Using awk, it is possible to extract a single table from a mysql dump file. You will need to know the name of the table you want AND the name of the table immediately after the table you want. I was able to find this info quicker than loading the whole dump file by going [...]

Optimize Mysql

No comments

The following command will optimize all databases in mysql (excpect those that don't support it due to their storage engine). mysqlcheck -Aao You can throw the –auto-repair flag in if you are brave.