Mysql #1067-无效的默认值';记住"令牌"';
在Lynda教程“启动并运行Laravel”中,创建了一个示例应用程序(authapp),允许用户登录 以下是create_用户迁移的结构:Mysql #1067-无效的默认值';记住"令牌"';,mysql,laravel,phpmyadmin,Mysql,Laravel,Phpmyadmin,在Lynda教程“启动并运行Laravel”中,创建了一个示例应用程序(authapp),允许用户登录 以下是create_用户迁移的结构: public function up() { Schema::create('users', function($newtable) { $newtable->increments('id'); $newtable->string('email')->
public function up()
{
Schema::create('users', function($newtable)
{
$newtable->increments('id');
$newtable->string('email')->unique();
$newtable->string('username',100)->unique();
$newtable->string('password',50);
$newtable->string('remember_token',100);
$newtable->timestamps();
});
}
下面是相应的视图文件摘录:
{{ Form::open(array('url'=>'register')) }}
{{ Form::label('email', 'Email Address') }}
{{ Form::text('email') }}
{{ Form::label('username', 'Username') }}
{{ Form::text('username') }}
{{ Form::label('password', 'Password') }}
{{ Form::password('password') }}
{{ Form::submit('Sign Up')}}
{{ Form::close() }}
当所有内容都被保存,并且我尝试在实际的应用程序中注册时,我得到了一个错误:教程说这是因为没有为记住\u token
变量设置默认值,并建议转到phpMyAdmin将默认值设置为NULL
但是,当我这样做时,会收到以下错误消息:
因此,我无法修复错误并继续
您知道如何处理这种情况吗?在phpMyAdmin中,您还需要选中
Null
复选框,以允许此字段中出现空值
在屏幕截图的右侧,它几乎没有被截断。我只看到空复选框没有被选中。同时选中空复选框,将字段设置为可空。谢谢Barry。正如上面helion3所说,这实际上是正确的举动。