Question: Hi Sql Error When Installing

Hi Sql Error When Installing

I am installing on cpanel and getting this error SQL: unable to create tables, SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 byt

M

mnusae

Asked
I am installing on cpanel and getting this error

SQL: unable to create tables, SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes

My database name is : howsae_ab
PHP Version 7.4.11
MySQL Version 10.3.27-MariaDB
  • MS

    Mian Saleem

    Answered
    Hello,

    Please try any of the following solution.

    ---

    **Solution 1**

    Please try to add the following line to `boot` method of `app/Providers/AppServiceProvider.php` around line no 66

    ```php
    \Illuminate\Support\Facades\Schema::defaultStringLength(191);
    ```

    ---

    **Solution 2**

    Please set default mysql engine to `InnoDB` in `config/database.php` around line no 58

    ```
    'engine' => 'InnoDB',
    ```

    ---

    **Solution 3**

    Change the default `charset` & `collation` in `config/database.php` around line no 53 & 54

    ```
    'charset' => 'utf8',
    'collation' => 'utf8_unicode_ci',
    ```

    ---

    After change, try to install again. Let me know if you still have issue.

    Thank you
  • M

    mnusae

    Answered
    Not working,

    Solution 1 didn't work, it broke the code.
    Solution 2 & 3 both used individually or both changes together getting this error below

    SQL: unable to create tables, SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'accounts' already exists
  • MS

    Mian Saleem

    Answered
    Hello,

    Please install with empty database OR delete all the tables before trying again.

    Thank you
  • M

    mnusae

    Answered
    Hi Now I am getting this error, I have emptied the DB and used Solution 2 & 3

    SQL: unable to create tables, SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes
  • MS

    Mian Saleem

    Answered
    Hello,

    Please let me know your server details in private reply so that I can check.

    Thank you
  • M

    mnusae

    Answered
    You mean you want me to me you email you at [email protected], or how to send a private reply on https://tecdiary.net/support
  • M

    mnusae

    Answered
    I have just emailed you at [email protected].
  • MS

    Mian Saleem

    Answered
    Hello,

    I am so sorry, the solution I shared are only after install :(

    If you want to use the your default database engine, you can reset the files.

    I have fixed the issue, please try to install now and let me if you still have issue.

    You can add private reply here by enabling the `PRIVATE for Staff only` at top right of reply section.

    Thank you
  • M

    mnusae

    Answered
    Hello,

    Thanks , what was the issue, as I will be moving this to another domain and deleting it from here.
    Let me know so that I can have a smooth move. Thanks.
  • M

    mnusae

    Answered
    Even after putting all details in the settings page, I am getting this error.

    How to disable the EMAIL & SMS COMPLETLY.

    There are 2 form errors.
    Please make sure that you have filled all Mail & Nexmo settings correctly before enabling the notifications.
  • Login to Reply