OCS engine can't comunicate with mysql server. Probably due to a wrong mysql account. You have to check z-ocsinventory-server.conf (ocsinventory-server.conf on Windows Server), exactly these few lines:
# Master Database settings
# Replace localhost by hostname or ip of MySQL server for WRITE
PerlSetEnv OCS_DB_HOST localhost
# Replace 3306 by port where running MySQL server, generally 3306
PerlSetEnv OCS_DB_PORT 3306
# Name of database
PerlSetEnv OCS_DB_NAME ocsweb
PerlSetEnv OCS_DB_LOCAL ocsweb
# User allowed to connect to database
PerlSetEnv OCS_DB_USER ocs
# Password for user
PerlSetVar OCS_DB_PWD ocs
If your password contains some specials characters, you can use single quote ( ' ) around it.