I converted my MySQL database to SQLite one, but now the login system is not working anymore. I’m using
SESSION_DRIVER=file. What’s wrong?
When I type my email and password and press Login, the system redirects me at Login page again without any error messages.
I tried to change the redirect route after login many times, and only that are unauthenticated routes are working; This is because
Auth::user or auth()->user() are Undefined objects. The login is going well, because if I make a typo in password the system tells me that credentials are wrong.
Obviously, I tried to do queries when SQLite database is set and are working well (
AppUser::first()->name in login.blade.php, for example).
I tried to revert
DB_CONNECTION=mysql and all works as expected (as before too): when I login with my email and password the system redirects me to the dashboard.
I’m using Laravel 5.7 in Windows 10 with SQLite 3.26.
Part of my .env file
APP_NAME=***** APP_ENV=local APP_KEY=****** APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost DB_CONNECTION=sqlite DB_DATABASE=database.sqlite BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file SESSION_LIFETIME=120 QUEUE_DRIVER=sync ... SNAPPY_PDF_BIN='C://"Program Files"/wkhtmltopdf/bin/wkhtmltopdf' SNAPPY_IMG_BIN='C://"Program Files"/wkhtmltopdf/bin/wkhtmltoimage' SES_KEY=**** SES_SECRET=****
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
I found the solution. Laravel did not have any problem, the problem was the sqlite database (the file). It was not well converted from mysql to sqlite. In the end the only thing that worked is the “famous” bash script “mysql2sqlite.sh” that you can find here. It only works for me with database empty. With data, I get an error when doing the conversion.
I hope I can help someone, greetings!