How to Fix “Warning: mysql_connect(): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)”

Home » Knowledge Base » F.A.Q. » Database Management » How to Fix “Warning: mysql_connect(): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)”

The reason for this warning is due to the fact that you are using localhost as the hostname for your database in your script. Please note that localhost is used only when your web and database are located on the same server. On our hosting platform, the database is located on a separate server. In order to connect to your database, you must use the hostname for your database. You can find this information inside the Database Manager of your hosting control panel.

Was this post helpful?

i

Relevant tags:

Connect

Latest posts:

How to Fix 307 Temporary Redirect

307 Temporary Redirect is a response HTTP status code that indicates the requested resource has been moved to a different URL for a limited period of time. Unlike a 301 permanent redirect, the 307 Temporary Redirect message indicates that the change is temporary and...

How to Access Crontab Settings

To access the crontab settings, first, you need to log in to your AwardSpace hosting panel. After you have logged in, head to Crontab Settings, located within the Advanced Tools category:   After you click the Crontab Settings icon, a new page should load. Once...

How to Check My Auto Renewals

To check your AwardSpace hosting plan auto-renewals, first log in to the admin dashboard. Then, head to Wallet, within the Orders & Invoices section:   After that, click the Auto Renewals tab, where you can check any relevant information about your hosting...

How to Check My Payment Requests

To check your payment requests, first log in to the AwardSpace hosting panel. Then, head to Wallet within the Orders & Invoices category:   Then, click the Payment Requests tab. There, you can browse all the information you need about your...

How to Check My Invoices

To check your invoices in AwardSpace, first log in to the hosting panel. From there, head to Invoices within the Orders & Invoices category:   From this place, you can browse order references, payment orders, payment types, order dates, and various...



Create a website for free!


Free forever

Our Support Team is Here to Help

 

If you need any questions answered, don't hesitate and contact us. Click the button below and follow the instructions. You can expect an answer within an hour.

 

Contact AwardSpace

 

iNewest knowledge base articles

How to Fix 307 Temporary Redirect

307 Temporary Redirect is a response HTTP status code that indicates the requested resource has been moved to a different URL for a limited period of time. Unlike a 301 permanent redirect, the 307 Temporary Redirect message indicates that the change is temporary and...

How to Access Crontab Settings

To access the crontab settings, first, you need to log in to your AwardSpace hosting panel. After you have logged in, head to Crontab Settings, located within the Advanced Tools category:   After you click the Crontab Settings icon, a new page should load. Once...

How to Check My Auto Renewals

To check your AwardSpace hosting plan auto-renewals, first log in to the admin dashboard. Then, head to Wallet, within the Orders & Invoices section:   After that, click the Auto Renewals tab, where you can check any relevant information about your hosting...

How to Check My Payment Requests

To check your payment requests, first log in to the AwardSpace hosting panel. Then, head to Wallet within the Orders & Invoices category:   Then, click the Payment Requests tab. There, you can browse all the information you need about your...

How to Check My Invoices

To check your invoices in AwardSpace, first log in to the hosting panel. From there, head to Invoices within the Orders & Invoices category:   From this place, you can browse order references, payment orders, payment types, order dates, and various...

How to Check My Wallet Flow

To check your wallet flow, first log in to the AwardSpace hosting panel. Then, click on Wallet within Payments & Invoices:   After that, click the Wallet Flow tab. This is where you can see details about your wallet flaw:

Even more web tutorials

Check out our web hosting knowledge base and the WordPress tutorials to learn more, and be better prepared for your website creation and maintenance journey.