On the local windows system, I set up the apache, php, and mysql environments. Use the following code: $ linkmysql_connect (& #39; localhost & #39;, & #39; Username & #39;, & #39; password & #39 ;); if (! $ Link) echo & quot; failed! & Quot; elseecho & quot; success! & Quot; mysql_close (); failed is displayed on the page. Help ~ After an afternoon, please advise. Troubleshooting: successful connections to navicat php databases
On the local windows system, I set up the apache, php, and mysql environments.
Use the following code:
$ Link = mysql_connect ('localhost', 'username', 'password ');
If (! $ Link)
Echo "failed! ";
Else
Echo "success! ";
Mysql_close ();
The page displays failed.
Help ~ After an afternoon, please advise.
Troubleshooting:
If navicat can successfully connect to the database, the port number is 3306, and the account and password are correct.
Safemode = off (security mode not enabled) in php. ini)
C: \ WINNT \ system32 \ drivers \ etc \ hosts added 127.0.0.1 localhost
Phpinfo () is displayed as follows:
Mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version mysqlnd 5.0.11-dev-20120503-$ Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $
Directive Local Value Master Value
Mysql. allow_local_infile On
Mysql. allow_persistent On
Mysql. connect_timeout 60 60
Mysql. default_host no value
Mysql. default_password no value
Mysql. default_port no value
Mysql. default_socket no value
Mysql. default_user no value
Mysql. max_links Unlimited
Mysql. max_persistent Unlimited
Mysql. trace_mode Off
Thank you ~