I am getting this MySQL error while trying to access the site and and even while trying to log into administrator.
Database Error: Unable to connect to the database:Could not connect to MySQL
I have tried refreshing and accessing it a dozen times.
Can somebody please help me to restart MySQL?
what system are you running mysql on? it obviously is A) not running B) the port's not accepting connections
Restart your sql services.
$ sudo service mysql restart
should do the trick to restart the database.
Otherwise, make sure you're using the proper parameters when you instantiate the connection object, or procedural connection.
It depends on the distribution of operating system a lot of times, try what Dynamic_Gravity suggested it's likely to work, might be called mysqld or something too. Also this isn't really the correct section to post this in :).
You can start/stop the mysql service on the server by logging into the server as root from the command line interface and run the following command/s.
service mysql stop
service mysql start
service mysql restart
You can also use the following if the above does not work fine.
Fix Toolbox for MySQL