Question

500 error using mysql_connect

Posted February 6, 2013 8.8k views
Hi, in every php file were I use command line mysql_connect("localhost","root","password"); I get 500 error, how can I fix this Problem thanks ;)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
8 answers
That most likely means that either your MySQL server isn't running your login credentials are incorrect. A 500 server error is displayed by the web server whenever a script fails to execute and the full details are located in the web server error log so if you check that you'll see if its a user login issue or something else and we can troubleshoot from there.
well I'm novice, i try this "sudo service mysql start" I get the answer from server "Job is already running: mysql"
Check that you have configured MySQL properly by running phpinfo(); It'll be about 2 thirds of the way down
well here is my http://192.34.63.89/info.php
Are you running Apache or Nginx?

Either way check the config and it will say where the error log is located.

Then you can tail the error log and hit the webserver when you get that error and you will see the exact error that you are receiving.

You can also run the script from the command line and see what error you run into as it is most likely the same thing via the webserver unless it excepts inputs via params.
phpmyadmin is working well
Its not an issue with your MySQL and PHP but with the particular script you are running so you will need to review the error log.
Submit an Answer