MySQL insert into user database failure

mysql

I kept getting an error for “Column count doesn’t match value count at row 1″.

My MySQL [5.0.96] version probably had some extra columns. So…

INSERT INTO user VALUES (‘localhost’,’root’,password(‘newpassword’),’Y’,’Y ‘,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’, ‘Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,” ,”,”,”,0,0,0,0);

Redirecting outbound email with exim

exim, linux

I wanted to build a replica of our production environment on a development environment, one problem being that our production environment sends a lot of emails to our clients.

I therefore needed to redirect or restrict all of our outbound emails.

With that in mind, I needed to make sure that exim [typically what we use to send mails] would not be able to send any mail to our clients, and instead it would be sending mails to a manually defined inbox.

The first thing I needed to do, was check that exim was actually working.

I sent myself an email:

/usr/sbin/exim -v ‘alex@myemail.com’
Some message here
[CTRL+D]

That  then responded with the 250 OK codes to confirm that the mail had been delivered to myself.

That’s no good on this environment though, as I needed to ensure that exim would be redirecting to a defined mailbox. Let’s call it “some@mailbox.com”

To do this, I needed to change the routers on the exim configuration file (/etc/exim/exim.cnf).

In vim, search for the string “begin routers”

The crucial point here is that the order of which the routers are defined is important, so you will need to put the new, first rule for routers at the top of this section. What did I include?

blah:
driver = redirect
domains = whereitscomingfrom.com
data = some@mailbox.com

I then repeated the mail send:

/usr/sbin/exim -v ‘alex@myemail.com’
Some message here
[CTRL+D]

I could then see a 250 OK code, but it was actually going to some@mailbox.com instead.

Displaying the size of each MySQL table in GB

mysql

Use the below command to display the size of each MySQL table in GB. This will also show the size of the index length, the number of rows and the total data length.

SELECT CONCAT(table_schema, ‘.’, table_name),
CONCAT(ROUND(table_rows / 1000000, 2), ‘M’) rows,
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), ‘G’) DATA,
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), ‘G’) idx,
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), ‘G’) total_size,
ROUND(index_length / data_length, 2) idxfrac
information_schema.TABLES
ORDER BY data_length + index_length DESC
LIMIT 10;