[笔记] Laravel 入门教程本地项目配置远程服务器数据库
首先 .env
文件配置远程服务器端的信息
虚拟机运行 php artisan migrate
然后是各种报错,经过一段时间的百度、谷歌,最终解决方案:
1、创建数据库时排序规则 utf8mb4_unicode_ci
2、数据迁移文件中,严格限制用户名、密码、邮箱的字段长度。
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name',50);
$table->string('email',60)->unique();
$table->string('password',60);
$table->rememberToken();
$table->timestamps();
});
}
Tips:框架默认 UTC 时区,可在 config/app.php
文件中修改配置
'timezone' => 'Asia/Shanghai',
这样就变成了中国时区了。
本作品采用《CC 协议》,转载必须注明作者和本文链接
推荐文章: