500 error using mysql_connect

February 6, 2013 4k 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 ;)
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
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.
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.
Have another answer? Share your knowledge.