SQLite vs MySQL: 5 Differences Laravel Devs Need to Know

preview_player
Показать описание
If you are using SQLite and MySQL interchangably with Laravel, be cautious about some differences in the details.

Support the channel by checking out my products:

Other places to follow:
Рекомендации по теме
Комментарии
Автор

Another difference is concurrency—SQLite locks the whole database during writes, while MySQL allows multiple concurrent writes, making it better for high-traffic applications. Schema changes are also easier in MySQL, since SQLite has more limitations with ALTER TABLE. Transactions work differently too—MySQL (with InnoDB) handles rollbacks more efficiently under load, while SQLite can slow down due to its single-file architecture. Also, MySQL has built-in user management with different privileges, while SQLite has no built-in user authentication, relying on file-level permissions instead. Lastly, indexing performance can differ, especially with full-text search, where MySQL has dedicated support while SQLite’s implementation is more basic

eyemazed
Автор

I just wanna use sqlite for a local invoice app. Thank for this information!

marccalis
Автор

for MySQL the db collation is likely case-insensitive by default. `COLLATE utf8_general_ci` where `ci` is case-insensitive while `cs` is case-sensitive.

CREATE TABLE my_table ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

jamiepage
Автор

Please make a video on the difference between MySQL and Maria db.

AhsanKhan
Автор

a difference i've found is dealing with numbers: in sqlite there's no 'tinyInt' and these "subtypes"; if you inform them in the migration, they become by default a simple integer type there.

ClashRoyale-ptzj
Автор

Great video & explanations! I also had a similar experience but with MySQL and MariaDB. I was using MAMP back then and there MySQL was used. However, the server on which I deployed used MariaDB, and that is when I encountered several issues.. My takeaway from that was that I will always use the same technologies or plattform as good as possible to reduce the risk of incompatibility between environments.. I think the same goes for the PHP version... I wouldn't use PHP 8.4 locally for development, if the production plattform is using PHP 8.3 - probably not a huge risk but still..

For me it just increases the risk and the workload afterwards (or at least "making it work in production") if you use different plattforms for that..

coding_david
Автор

I'm using laravel dusk. It was difficult to setup but worth it

stonebubbleprivat
Автор

You touched on JSON issues, however, I recall in previous shop, had an issue that certain JSON functions were unavailable for the Sqlite db we were using for testing (for example json_extract?, but don't quote me). Don't recall for certain if it was the version we were using or just a general incompatibility.

bagsmode
Автор

its missing some functions mysql has too i once spend hours figuring why my code wasnt working

drugoviic
Автор

Using MySQL with Laravel, but I also use SQLite for temporary transformation or search during job process - no need to pollute the main DB for that. Thus SQLite is ideal for manipulating data during job process and then just delete.

incoming-th
Автор

Sqlite is pretty simple and beautiful database, however it still have lot of known bugs which owners don’t want to fix to keep backwards compatibility.

map
Автор

It seems the Laravel docs are contradicting about foreign key:
The docs warning mentions they are disabled by default but if you follow the link as you did, it states:
By default, foreign key constraints are enabled for SQLite connections. If you would like to disable them, you should set the DB_FOREIGN_KEYS environment variable to false:

DB_FOREIGN_KEYS=false

Lukasz-online
Автор

Thanks for sharing this; it is very useful and I am also interested in calendar service implementation too if could share or make video that Thanks again

Shaqouun
Автор

Always use MySQL personally lol. Nobody can convince me to not use it

JamesAutoDude
Автор

I googled about SQLite and found that it is a lightweight solution designed for small projects with only one user. Does this mean it doesn't work for bigger projects, even though Laravel sets SQLite as the default database?

DoonSafari
Автор

How can i creare this html table in filament?

mahmoudreda
Автор

is this application you're using as an example part of al LMS of some of a course from yours?

ClashRoyale-ptzj
Автор

Someone please recommend video tutorial, or blog to switch from mysql to sqlite

DoonSafari
Автор

Well you have to set up your DB anyway for creds and such, why they'd choose to change the default at this point I'm unsure, not even sure why there's a "default" unless it's what >75% of the user base will be using, but the first thing I'd have to do is switch it to MySQL. Even for personal projects I just build in MySQL just because it's already on my system ready to go. Don't know how much of the Laravel user base uses SQLite but I think most PHP programmers already have the DB system they use regularly already set up and ready to build new schema in and, just guessing here, it's probably MySQL. Not seeing any advantage for Laravel here. I do know I'd never ever use DB X for dev knowing I'm going to have to port to DB Y for prod.

binbashbuddy
Автор

Might be more of my personal preference, but it seems (and always has been) like SQLite is an absolute no-go for me and for most projects I've seen.

Still can't really imagine why did Laravel team made this a default one

cardboarddignity