Wednesday, June 24, 2015

SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1

Hello,

Got this error message

SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1

We tried everything to insert in one table but this error didn't budged even for the simplest query we  wrote.

Then I found that there was a "TRIGGER" applied on this table which on insertion updates another table.

So the problem was with the stored procedure. There was some additional field in it.

I discovered the root cause as soon as I deleted the Trigger.

So the issue was with the error message, this error was not pin pointing that the field was missing on which table, due to the language of the error it seems like the error is with the immediate table but actually it can be with a connected one.

Hope this will help someone.

Thanx
Anshumaan Bakshi


Monday, April 27, 2015

Connection Failed: 'host' is not allowed to connect to this mysql server

Hello,

If you are getting following error while trying to connect your (PHP) application to a MySQL database

Connection Failed: 'host' is not allowed to connect to this MySQL server

Then this may due to limited privileges given to the user through which one s trying to connect with the server. Although a correct username and password is been used to connect still we have this error.

What happens is when a new MySQL user is added to a DB then the hostname name like localhost is added by default to user like user1@localhost. Now this user can access the DB for sure but while he is on the same machine not remotely.

The solution for this issue is to create a new user which has Any Host privileges "%" like

mysql> CREATE USER 'user2'@'%' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'user2'@'%' -> WITH GRANT OPTION;


Thanx
Anshumaan Bakshi