Closed topherseance closed 5 years ago
Also got these error during install, but easily solved with this link: https://laravel-news.com/laravel-5-4-key-too-long-error
Error during php artisan typicms:install
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
Fix on app/Providers/AppServiceProvider.php
use Illuminate\Support\Facades\Schema;
public function boot()
{
Schema::defaultStringLength(191);
}
Please install TypiCMS on an empty database. If you look at the log, you'll see "A migrations table was found in database [typicms_01], no migration and seed were done." So the required tables could not be installed. Can you retry with an empty DB?
Here's what I've done: (new/fresh install)
composer create-project typicms/base typicms-02
cd typicms-02
php artisan typicms:install
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
app/Providers/AppServiceProvider.php
:
use Illuminate\Support\Facades\Schema;
public function boot() { Schema::defaultStringLength(191); }
6. On `config/typicms.php`, set `mariadb` value to `true`
7. Delete & re-create the database (`typicms_02`)
8. Re-run `php artisan typicms:install`
The result:
Setting up database...
Enter a database name [typicms-02]:
typicms_02
What is your MySQL address? [127.0.0.1]:
What is your MySQL port? [3306]:
What is your MySQL username? [root]:
What is your MySQL password? [
Migration table created successfully. Migrating: 2012_12_06_225921_create_users_table Migrated: 2012_12_06_225921_create_users_table Migrating: 2012_12_06_225922_create_password_resets_table Migrated: 2012_12_06_225922_create_password_resets_table Migrating: 2013_08_29_174626_create_pages_table
Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access
violation: 1064 You have an error in your SQL syntax; check the manual that cor
responds to your MariaDB server version for the right syntax to use near 'json n
ot null, slug
json not null, uri
json not null, body
json not null, ' at l
ine 1 (SQL: create table typicms_pages
(id
int unsigned not null auto_increm
ent primary key, image_id
int unsigned null, position
int unsigned not null
default '0', parent_id
int unsigned null, private
tinyint(1) not null defaul
t '0', is_home
tinyint(1) not null default '0', redirect
tinyint(1) not null
default '0', title
json not null, slug
json not null, uri
json not null,
body
json not null, status
json not null, meta_keywords
json not null, me ta_description
json not null, css
text null, js
text null, module
varchar
(191) null, template
varchar(191) null, created_at
timestamp null, updated_ at
timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci' e
ngine = InnoDB)
at C:\Topher_Work\Laravel\typicms-02\vendor\laravel\framework\src\Illuminate\ Database\Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make th is exception a 662| // lot more helpful to the developer instead of just the databa se's errors. 663| catch (Exception $e) {
664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668|
Exception trace:
1 PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1064 Yo
u have an error in your SQL syntax; check the manual that corresponds to your Ma
riaDB server version for the right syntax to use near 'json not null, slug
jso
n not null, uri
json not null, body
json not null, ' at line 1")
C:\Topher_Work\Laravel\typicms-02\vendor\laravel\framework\src\Illuminate
\Database\Connection.php:452
2 PDO::prepare("create table typicms_pages
(id
int unsigned not null aut
o_increment primary key, image_id
int unsigned null, position
int unsigned n
ot null default '0', parent_id
int unsigned null, private
tinyint(1) not nul
l default '0', is_home
tinyint(1) not null default '0', redirect
tinyint(1)
not null default '0', title
json not null, slug
json not null, uri
json no
t null, body
json not null, status
json not null, meta_keywords
json not n
ull, meta_description
json not null, css
text null, js
text null, module
varchar(191) null, template
varchar(191) null, created_at
timestamp null, updated_at
timestamp null) default character set utf8mb4 collate 'utf8mb4_unico
de_ci' engine = InnoDB")
C:\Topher_Work\Laravel\typicms-02\vendor\laravel\framework\src\Illuminate
\Database\Connection.php:452
Please use the argument -v to see more details.
Seems like a common issue regarding `JSON` datatype on MariaDB and MySQL:
- https://github.com/laravel/framework/issues/13622
- https://stackoverflow.com/questions/42185598/1064-you-have-an-error-in-your-sql-syntax-check-the-manual-that-corresponds
Here's excerpt from my XAMPP's readme. (/xampp/readme_en.txt
)
I think MariaDB 10.1 doesn't have support for JSON datatype
###### ApacheFriends XAMPP Version 7.3.4 ######
Important! PHP in this package needs the Microsoft Visual C++ 2015 Redistributable package from
http://www.microsoft.com/en-us/download/. Please ensure that the VC++ 2015 runtime
libraries are installed on your system.
+ Apache 2.4.39
+ MariaDB 10.1.38
+ PHP 7.3.4 (VC15 X86 64bit thread safe) + PEAR
+ phpMyAdmin 4.8.5
+ OpenSSL 1.1.0g
+ ADOdb 518a
+ Mercury Mail Transport System v4.63 (not included in the portable version)
+ FileZilla FTP Server 0.9.41 (not included in the portable version)
+ Webalizer 2.23-04 (not included in the portable version)
+ Strawberry Perl 5.16.3.1 Portable
+ Tomcat 7.0.92
+ XAMPP Control Panel Version 3.2.3.
+ XAMPP mailToDisk 1.0 (write emails via PHP on local disk in <xampp>\mailoutput. Activated in the php.ini as mail default.)
...
Of course you need the latest version of MariaDB. Let me know if it works better.
Environment: OS: Windows 7, 64bit Using XAMPP latest version PHP 7.3.4 & MariaDB
Run these commands:
Get a "404 Not found" page on both
/
and/admin
(redirected toen/login
) https://gyazo.com/05ed08df4b35b3b197c05de3be80605eFull installation cmd log: