Why is it recommended to use MD5() or SHA2() instead of the PASSWORD() function in MySQL for password encryption in applications?

The PASSWORD() function in MySQL is not considered secure for password encryption as it uses a weak hashing algorithm. It is recommended to use MD5() or SHA2() functions for more secure password hashing in applications.

$password = 'password123';
$hashed_password = hash('sha256', $password);