I have a problem with PDO, and I see absolutely nowhere he comes. I can not question my MySQL database. Just to test I used the following code (having quite sour previously configured the parameters for the connection:
protected function createMigrationsTable()
{
$this->pdo->exec("CREATE TABLE IF NOT EXISTS migrations (
id INT AUTO_INCREMENT PRIMARY KEY,
migration VARCHAR(255),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=INNODB;");
}
The connection is made correctly with MySQL but after migration, I get this error:
CodePudding user response:
CHECK the DSN string. For MySQL it should look like this:
mysql:host=hostname_or_ip;port=XXXX;dbname=name_of_db
or after establishing connection, make:
$this->pdo->exec("USE database_name");