Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name '' (SQL: create table `` (migration varchar(255) not n
ull, batch int not null) default character set utf8 collate utf8_unicode_ci)

[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name ''

This shows that there is error while creating the migration, usually with connection issue.

You see, migration table is always created when we are using migrations.

Have you check the connection string?

I'm guessing you're using MySQL. It's in the root .env file, and search for these lines:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1 //or localhost
DB_PORT=the_port
DB_DATABASE=your_db_name
DB_USERNAME=your_username
DB_PASSWORD=your_password

Then edit the connections accordingly.

Last updated 8 years ago.
0

DB_HOST=127.0.0.1 DB_DATABASE=blues_main DB_USERNAME=homestead DB_PASSWORD=secret

0

stu3881 said:

DB_HOST=127.0.0.1 DB_DATABASE=blues_main DB_USERNAME=homestead DB_PASSWORD=secret

Try changing 127.0.0.1 with localhost

0

Hi, I keep suggesting that I've "done something" and it's broken my project. Basically, i had everything pretty much configured correctly and working. I did see that i didn't have a DB_CONNECTION or DB_PORT in .ENV so i added them. I imagine that it doesn't make any difference since i have several working connections defined already in config/database.php.

As a test, i created a new laravel project "l5_blues2". i think this one is 5.3. "blues_main" is my default database. i did a vagrant ssh to get me into homestead and i created the blues_main database using mysql. i opened another and ssh'd into .../code/blues2 I ran php artisan migrate:install and it successfully created the migrations table (YAY!). Then i ran php artisan migrate and it updated the migrations table accordingly. I readded the migrations to the folder in the order they had been loaded originally. php artisan migration:status shows all migrations as complete. Then i went back to my other tab and ran the mysqldump to load just the data from the original mysqldump.

The old app (l5_larablues) reads the database just fine and I'm essentially back in business. And, i have a working backup and recovery of my vm database; however crude.

But, the is not a fix, it's just a recovery.

We can see that laravel detects that he needs to create the migrations table, but where he's getting the name is now blank. That's what i'd like to be able to do.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

stu3881 stu3881 Joined 22 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.