ERROR 2003 (HY000): Can’t connect to MySQL server on ‘127.0.0.1’ (111)

If you are using ubuntu, you have to use the following steps to avoid this error(if there is no replication enabled): run the command vim /etc/mysql/my.cnf comment bind-address = 127.0.0.1 using the # symbol restart your mysql server once. Update In Step 1, if you cannot find bind-address in the my.cnf file, look for it in /etc/mysql/mysql.conf.d/mysqld.cnf file. Update in case of MySQL replication enabled … Read more

PDO bindParam() with prepared statement isn’t working

Using bindParam() the variable is bound as a reference. A string can’t be passed by reference. The following things can be passed by reference: Variables, i.e. foo($a) New statements, i.e. foo(new foobar()) References returned from functions Try using bindValue()

MySQL WHERE IN ()

Your query translates to It will only return the results that match it. One way of solving it avoiding the complexity would be, chaning the datatype to SET. Then you could use, FIND_IN_SET

Database sharding vs partitioning

Partitioning is more a generic term for dividing data across tables or databases. Sharding is one specific type of partitioning, part of what is called horizontal partitioning. Here you replicate the schema across (typically) multiple instances or servers, using some kind of logic or identifier to know which instance or server to look for the … Read more

mysql Foreign key constraint is incorrectly formed error

I ran into this same problem with HeidiSQL. The error you receive is very cryptic. My problem ended up being that the foreign key column and the referencing column were not of the same type or length. The foreign key column was SMALLINT(5) UNSIGNED and the referenced column was INT(10) UNSIGNED. Once I made them both the same … Read more