Это особеность только на маке?
]]>'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
Или в файл .env
DB_SOCKET='/Applications/MAMP/tmp/mysql/mysql.sock'
После переноса сайта на хостинг эту строку нужно обязательно удалить
]]>Я так понимаю вся причина не выполнения миграций кроется где-то здесь.
]]>Содержимое модели:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateContactsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('contacts', function (Blueprint $table) {
$table->increments('id');
$table->string('email');
$table->string('subject');
$table->text('message');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('contacts');
}
}
дальше выполняю миграцию: php artisan migrate
здесь получаю кучу ошибок:
Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations)
at /Users/serega/Sites/laravel.dev/lara/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 this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|Exception trace:
1 PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)")
/Users/serega/Sites/laravel.dev/lara/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:702 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=laravel", "root", "root", [])
/Users/serega/Sites/laravel.dev/lara/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70Please use the argument -v to see more details.
Пробую выполнить миграцию с -v и получаю следующее:
Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations)
at /Users/serega/Sites/laravel.dev/lara/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 this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|Exception trace:
.... далее еще 32 строки с ошибками
любая команда с вязаная с миграцией выдает сначала Please use the argument -v to see more details. потом снова та-же ошибка что предоставил выше.
Как это исправить?