How can MD5 hashing be implemented in a PHP script for password security in MySQL?

To enhance password security in MySQL, MD5 hashing can be implemented in a PHP script. This involves hashing the user's password using the MD5 algorithm before storing it in the database. This way, even if the database is compromised, the passwords will be stored securely as irreversible hashes.

// Assuming $password contains the user's password
$hashed_password = md5($password);

// Store $hashed_password in the database
// Example query: INSERT INTO users (username, password) VALUES ('$username', '$hashed_password');