500 error using mysql_connect

  • Posted February 6, 2013


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 ;)


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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.

phpmyadmin is working well

Apache is on

Are you running Apache or Nginx? <br> <br>Either way check the config and it will say where the error log is located. <br> <br>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. <br> <br>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.

Check that you have configured MySQL properly by running phpinfo(); It’ll be about 2 thirds of the way down

well I’m novice, i try this “sudo service mysql start” I get the answer from server “Job is already running: mysql”

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.