How to Solve MySQL Socket Error mysqld.sock

Issue:

Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’

Error deleting data: Access denied for user ”@’localhost’ (using password: NO)

Environment:

Docker, Apache/2.4.10 (Debian), PHP Version 5.3.29, MySQL Version 5.7

Resolution:

Below is the sample code that produce an error. What happened was on mysql_query($query) statement, it doesn’t has connection defined and rely on $conection to be open before this statement can be executed.

    $query = sprintf( "DELETE FROM tablename where ID = %ld;", $this->ID );
    $result = mysql_query( $query );
    if( !$result ) {
      die('Error deleting data: '.mysql_error());
    }

 

So, to solve this problem, make sure you have $connection open before executing mysql_query() as shown below:

    $connection = database_connect( $database_name );
    $query = sprintf( "DELETE FROM tablename where ID = %ld;", $this->ID );
    $result = mysql_query( $query );
    if( !$result ) {
      die('Error deleting data: '.mysql_error());
    }

 

Troubleshoot:

Look for your connection to MySQL in your code!!

How To Solve “GatherAllFilesToPublish” Error?

Issue:

I’m getting an error “GatherAllFilesToPublish”  when tried to publish my code. What’s happening to my csproj file?

---------------------------
Publish failed
---------------------------
Publish has encountered an error.

Build failed. Check the Output window for more details.


A diagnostic log has been written to the following location:

"C:\Users\username\AppData\Local\Temp\1\tmpC98.tmp"
---------------------------
OK   
---------------------------

Error MSB4057: The target "GatherAllFilesToPublish" does not exist in the project

 

Environment:

Windows 10, Visual Studio 2019, C# Project with Framework 4.0

Resolution:

This error is due to incorrect setting on project file (*.csproj). Please follow step-by-step instructions below.

Step-by-step instructions:-

  1. Open you project under Visual Studio
  2. Right click on project name and select “Unload Project”
  3. Right click on project name again and select “Edit *.csproj”
  4. Scroll down to the bottom of the file and you should see following line:
    <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
  5. Replace above line with following two lines:
    <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
    
    <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />

  6. Save the file and right click on project name to Reload the project
  7. Try publish again to see if it solves the issue

Troubleshoot:

If fail again, please verify by going through step 2 to 4 to see if two lines still there.