Good question, but incorrectly worded.
Because there are actually two questions - which driver to use
and how to connect.
The answer to the first question is obvious. If you choose from mysql_connect, mysqli and PDO, then just go to the page of the manual
dedicated to each option, and see what it says. Well or to try to use in your code and see what happens.
But the question is how to connect the remaining two options, really important, and the answer is, as usual, almost no one knows because all have each other write articles not 2, but 22-year-old. Fortunately, there are sites with relevant information.
Theoretically, you can use mysqli. But it is not necessary. Because it's a low level driver and use it without preparation is very inconvenient. But if that you're impatient, here's how to connect using mysqli
- you want to set exceptions thrown
- you need to set the encoding
- when connecting you must catch the exception and throw it again, so no error message was username and password.
But the right answer, if you choose from these three will be PDO. Here is also not easy, so I look how to connect using PDO
- given the same key points as stated above.
A good option is to use a higher-level abstraction of the type to do so. But since the normal documentation for it, but there is only a couple Haimovich video where it is used, and without any explanation or analysis of the fundamentals, then I would recommend redbean experienced developer, not a beginner. But in any case, as it to connect, it is written in the documentation
The password in the database is not encrypted and hashed. This is done poosu function password_hash