Mysql5.5 prompt Deprecated: mysql_query (): The mysql extension is

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.