概述
安装laravel5.5
composer create-project --prefer-dist laravel/laravel blog "5.5.*"
首先确保安装好了laravel,并且数据库连接设置正确
composer require encore/laravel-admin:1.*
然后运行下面的命令来发布资源
php artisan vendor:publish --provider="EncoreAdminAdminServiceProvider"
接下来运行 php artisan admin:install
D:wwwrootwww.test.com>php artisan admin:install
Migration table created successfully.
In Connection.php line 664:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (S
QL: alter table `users` add unique `users_email_unique`(`email`))
In Connection.php line 458:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes
报错了,laravel 5.4 改变了默认的数据库字符集,现在utf8mb4包括存储emojis支持。如果你运行MySQL v5.7.7或者更高版本,则不需要做任何事情。
当你试着在一些MariaDB或者一些老版本的的MySQL上运行 migrations 命令时,就会遇到这个错误,改正方法:
在appProvidersAppServiceProvider.php添加默认值
use IlluminateSupportFacadesSchema; //add fixed sql
public function boot()
{
Schema::defaultStringLength(191); //add fixed sql
}
改完之后这里需要注意将之前得两张表删除,否则就会报这个错
In Connection.php line 664:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre
ady exists (SQL: create table `users` (`id` int unsigned not null auto_incr
ement primary key, `name` varchar(191) not null, `email` varchar(191) not n
ull, `password` varchar(191) not null, `remember_token` varchar(100) null,
`created_at` timestamp null, `updated_at` timestamp null) default character
set utf8mb4 collate utf8mb4_unicode_ci)
In PDOStatement.php line 119:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre
ady exists
In PDOStatement.php line 117:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre
ady exists
之后再来执行php artisan admin:install
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2016_01_04_173148_create_admin_tables
Migrated: 2016_01_04_173148_create_admin_tables
Admin directory was created: appAdmin
HomeController file was created: appAdmin/Controllers/HomeController.php
AuthController file was created: appAdmin/Controllers/AuthController.php
ExampleController file was created: appAdmin/Controllers/ExampleController.php
Bootstrap file was created: appAdmin/bootstrap.php
Routes file was created: appAdmin/routes.php
输入地址, http://localhost/admin/,使用用户名 admin 和密码 admin登录就可以啦
最后
以上就是甜美方盒为你收集整理的安装laravel-admin过程的全部内容,希望文章能够帮你解决安装laravel-admin过程所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复