Support the ongoing development of Laravel.io →
Authentication Database

I've got an existing users table for my website and am rebuilding the entire site in Laravel. I'm struggling with moving the data from the old users table to Laravel's users table. The problem is that the old table's password field isn't hashed and Laravel's is. I did the following and it didn't work.

INSERT INTO users(name,
email,
password)
SELECT old_users.Username,
old_users.Email,
MD5(old_users.Password)
FROM old_users

I also just moved them without worrying about the hashing. That didn't work either.

Suggestions?

Last updated 2 years ago.
0

MD5 is not a secure method of hashing passwords, and Laravel doesn't use it. Instead it uses Bcrypt (http://laravel.com/docs/5.0/hashing).

Assuming your passwords are currently stored un-encrypted, I would suggest instead of directly using SQL, you write your script in Laravel, to handle the transfer of users into the new table, and use the Hash::make function (see the link above) to encrypt your passwords using Bcrypt.

0

That worked! Thank you!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

jerauf jerauf Joined 16 Feb 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.

© 2025 Laravel.io - All rights reserved.