The mysql database is upgraded to mysql 5.5 today. the previous mysql_connect is used to connect to The database. the following message is displayed: Deprecated: mysql_connect (): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in, which means you don't need the mysql_connect function in the future. Let's take a look at the solution.
From the error message, it is not recommended to use the mysql_connect function. I can see from the official website that the mysql_connect function will not be used in the future. We recommend using mysqli or PDO instead, it is convenient to know the cause.
Solution 1: Set the alarm level in the php code
<? Php
Error_reporting = E_ALL &~ E_DEPRECATED
Method 2: Disable php to report an error
Display_errors = On to display_errors = Off
Method 3: Use mysqli or PDO
We recommend that you cancel mysql as soon as possible, all of which go to mysqli or PDO. Mysql is indeed too insecure and old.
Tips
The second method is a temporary solution, but it is also a commonly used solution. Now, many programs use mysql_connect to connect to the database.