Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Monday 28 December 2015

MySQL ERROR - Specified key was too long; max key length is 767 bytes

This is very old MySQL issue. MySQL engine like InnoDB or MyISAM has their own limit on the length of the columns where indexing can be applied. Usually it is 1000 for MyISAM and 767 for InnoDB. Problem occures when user try to change the length of the column where indexing was already applied or try to implement indexing on a column where length of column is already greater than 1000.
This problem can be solved in two ways:

1. Set the properties of MySQL engine. (It will only work for mysql 5.6+).

  • show engines;(Get the current Engine - Only to check).
  • show variables like 'innodb%'; (Get current engines properties)
  • Set properties as:
  • innodb_large_prefix=on;
  • innodb_file_format=barracuda;
  • innodb_file_per_table=true;
  • Run the alter command.
2. Set MySQL to no engine mode.
  • SELECT @@SESSION.sql_mode; (Check current SQL mode)
  • SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; (Set SQL mode to no engine)
  • run your alter command.
  • Again set back to engine mode

Monday 6 January 2014

How to skip grants in MySQLdatabase or start without password

If you wants to start MySql in 'skip-grant-tables' mode on Windows or without password.

Please follow the steps below
1). Stop the MySQL service through Administrator tools, Services.

2). Modify the my.ini configuration file (assuming default paths)
     C:\Program Files\MySQL\MySQL Server 5.5\my.ini

3). Change the contents as:
      In the SERVER SECTION, under [mysqld], add the following line:
     skip-grant-tables

    As:

    # SERVER SECTION
    # ----------------------------------------------------------------------
    #
    # The following options will be read by the MySQL Server. Make sure that
    # you have installed the server correctly (see above) so it reads this
    # file.
   #
   [mysqld]

   skip-grant-tables

4). Start the service again and you should be able to log into your database without a password.
share|improve this answer