As of this writing (Late 2020) it's still secure to use this function and 512 bits should suffice.
Hash sensitive information using MySQL
It digests (i.e. summarizes) strings of any size into a base-64 string, having 512 bits in length.
Apparently, this feature was added in MySQL version 5.5.5. Official Documentation for MySQL encryption functions.
INSERT INTO testing_table(id, name) VALUES (null,sha2('foo',512))