Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Tuesday, 19 May 2020

MySQL: Fix Error 1071 "Specified key was too long"

MySQL/MariaDB Error 1071 when try to import SQL File:

#1071 - Specified key was too long; max key length is 767 bytes
Sometime error is "max key length is 1000 bytes"

Reason:
From MySQL 5.6 and MariaDB 10.2.2 InnoDB File Format default is Barracudar. Barracudar is newer file type ,support many new format types (DYNAMIC and COMPRESSED). But in older version of MySQL or MariaDB default InnoDB File Format is still Antelope. So if you want to import a database using Barracudar(exported from newer version), you also need to change the current file format to Barracudar.

Solved:
To do that, run the following command in the Mysql command line (Root account is required):

SET GLOBAL innodb_file_format = Barracuda;
SET GLOBAL innodb_file_per_table = on;
SET GLOBAL innodb_default_row_format = dynamic;
SET GLOBAL innodb_large_prefix = 1;
SET GLOBAL innodb_file_format_max = Barracuda;
FLUSH PRIVILEGES;
Done ! The problem has been solved, you can try imoport SQL file again.

Tip: You can run Mysql command line from linux terminal or run Query in Navicat, PHPMyadmin ....

mysql -h localhost -u root -p
Refer: https://dev.mysql.com/doc/refman/5.6/en/innodb-file-format-enabling.html

Monday, 22 June 2015

Yii2: Unknown Property Exception after adding column to table

Unknown Property – yii\base\UnknownPropertyException
Getting unknown property: app\models

What happens when you get an error Exception "Getting unknown property", after just added a field to the table in the database ?
  1. Check your property name, was it correct?
  2. Clear cache if you using cache. Yii2 will cache the table schema so if you change the table you need to clear the cache

Monday, 24 November 2014

Yii2: Error invalid configuration with modules

Error: 
Invalid Configuration – yii\base\InvalidConfigException
The configuration for the "modules" component must contain a "class" element.
Solution: 
Check your config file.  don't put "modules" in component section.
Correct config:
'components'=>[
...
],
'modules'=>[
...
]

Readmore about module : https://github.com/yiisoft/yii2/blob/master/docs/guide/structure-modules.md 

Friday, 19 September 2014

MySQL: Allowed to remote connect to MySQL server

MySQL Error : Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server
How to fix it ?

STEP 1: Change mysql config :

vi /etc/mysql/my.cnf
Comment out following lines or edit to your client ip :
#bind-address           = 127.0.0.1
#skip-networking
Restart mysql server:
service mysql restart
STEP 2: Change GRANT privilege :

Login MySQL using command line .
Then run a command like below to grant access for user. Replace 'username' and 'password' with your username and password.
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;
* '%' mean you can remote access from any ip address, You can replace it with a specified ip address.

Then flush MySQL :
FLUSH PRIVILEGES;

If it's still not working. Let's check your server firewall (iptables ...) and client firewall (windows firewall, antivirus software)


Friday, 15 November 2013

CSS: Position fixed not working in IE

* IE 6 does not support position: fixed
* Other versions of IE (7,8,9) don't support position: fixed in quirks mode when you missing Doctype.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Wednesday, 11 September 2013

Yii: Recoverable error - Object of class *** could not be converted to string

We get this error when call a function such as : findAllByAttributes, Find, FindAll, Chtml, .,.,
because one of your parameter type is not correct.

example :

Recoverable error


Object of class OAuthSession could not be converted to string

to solve it let check type of all parameters in that function. Make sure that all of them are string.