php artisan migrate is not making tables in laravel 7 - mysql

i am trying to migrate my first migration in laravel 7 project i have created database in phpmyadmin. i have Laragon app for localServer, these are my .env code for database connection
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=portfolio-project
DB_USERNAME=root
DB_PASSWORD=
when i do php artisan migrate it tells me that migrations are migrated, but when i go to phpmyadmin for checking tables it says no tables in this database,
Is there any problem with my phpmyadmin?
O any issue in new version 7 of laravel?
because when i added a phpmyadmin to laragon app there was issue with login password of phpmyadmin,
default password was not working and then i think i edit of its files to make no password at login on phpmyadmin after that i just type root as use and login it works, other old version laravel pakgs are working but this new version of laravel is making this issue at php artisan migrate

Make sure that every time you change your .env file you also do the following commands to clear any cache and make sure you are using the latest changes :
php artisan config:clear
php artisan cache:clear
Also make sure that root has no password and you can login to phpmyadmin without one.

First, close the server and the cmd and start it again then run the following command:
php artisan config:clear
Then run one of these commands:
php artisan migrate:fresh
or
php artisan migrate:refresh
It will drop all tables and recreate them again with the new migrations.
Hope it helps :)

Related

switched to mysql from sqlite, unable to migrate databse

I was using sqlite and just tried to connect to my Mysql database by
changing the env.
php artisan migrate:fresh
Nothing Happened
Here's my .env:-
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=white
DB_USERNAME=root
DB_PASSWORD=
I tried deleting the sqlite file and now it shows me this error :- Database (/home/kabir/Desktop/White/database/database.sqlite) does not exist. (SQL: PRAGMA foreign_keys = ON;)
which is normal
Try clearing config and cache files.
In your terminal try
php artisan cache:clear
The solution to this situation is to run these commands:-
php artisan config:clear
php artisan cache:clear

Is there a way to reset all configuration in MySQL?

I need your help again.
Is there a way to reset all configuration in MySQL?
Here's what happened. I previously have a project installed and this time I'm setting up a new one.
In this new project, I wanted to set it up with my a new database, new username I created and password. However, when I reached the point where I had to execute php artisan migrate, it keeps throwing me an error saying PDOException::("SQLSTATE[HY000] [2002] No such file or directory")
If not that error, it's throwing connection refused instead.
Note: I'm using laradock.
Now, I'm at the point where I'd just rather reset the whole MySQL because I'm thinking it's conflicting with my previous configuration with my previous project.
As I searched online, I've tried the following:
1. Restarted server
2. Changed db_host from 127.0.0.1 to localhost and vice-versa
3. Added the project's directory to the dev environment setting
4. Docker-compose down and then up again
5. Even uninstalled and reinstalled docker itself
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=newdbname
DB_USERNAME=newusername
DB_PASSWORD=newpassword!
All I want is to be able to execute php artisan migrate using the new credentials I set.
If you really do not need any old data in database, you can just delete them & reset up a container:
# stop mysql service
docker-compose stop mysql
# delete old mysql database
rm -rf ~/.laradock/data/mysql
# resetup mysql container
docker-compose up -d nginx mysql
You can get the mysql database location according to docker-compose.yml & env-example:
docker-compose.yml:
volumes:
- ${DATA_PATH_HOST}/mysql:/var/lib/mysql
env-example:
DATA_PATH_HOST=~/.laradock/data

Laravel migration works in strange way

I've dropped my test database then I want to create new database using saved migrations:
2017_03_01_000000_create_api_table.php
2017_03_06_000000_create_beeline_calls.php
2017_03_13_000000_modify_beeline_emails.php
2017_03_14_000000_interactive_forms.php
2017_03_16_000000_model_instances.php
2017_03_24_000000_create_objects.php
2017_03_24_000001_create_objects_tables_v2.php
2017_03_24_000003_make_comments_without_users.php
2017_03_27_000000_add_processed_to_announcements.php
2017_03_29_000000_create_ads_channels.php
2017_03_29_000001_announcement_client.php
2017_04_06_000000_create_filters.php
2017_04_07_000000_create_new_input_types.php
When I run php artisan migrate --pretend
[Doctrine\DBAL\Schema\SchemaException]
There is no column with name 'creator_id' on table 'application_model_instance_announcement_comments'.
But first migration file to run is 2017_03_01_000000_create_api_table.php
Why does it run not from start? Database is empty, migrations table is empty.
As I understand Laravel should run migration files in alphabetical order.
To be able to perform php artisan migrate that table where you are creating the columns can't contain the same column names as in that migration. You must delete it first and with this command
php artisan migrate:refresh
you are doing exactly this
php artisan migrate:rollback
php artisan migrate
There are 2 commands in php artisan migrate:refresh
When changing something in migrations always run these commands:
php artisan cache:clear
php artisan view:clear
php artisan route:clear
composer dump-autoload
It will clear all old stuff and should run smoothly!

In laravel 5.4 php artisan migrate creating only one table

I created three migrations with php artisan make:migration and after that I ran php artisan migrate. This command creating only one table in my database instead of 3.

Where do I find my table in MySQL after I run a Laravel migration using Homestead?

I am trying to create a "Basic Task List" according to the Laravel documentation. After I run "php artisan migrate", I can see that that my tables were migrated successfully according to the console, which is Git Bash.
In phpmyadmin, the following databases are visible:
homestead
information_schema
mysql
performance_schema
sys
However, I couldn't find my new "tasks" table anywhere in phpmyadmin. Where is my table located in mysql?
It is in the homestead database.
Check your .env and config/database.php files and you'll see how your database is set.