Turn Your Vehicle Into a Smart Earning Asset

While you’re not driving your car or bike, it can still be working for you. MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.

πŸš— You set the rental price
πŸ” Secure bookings with verified renters
πŸ“ Track your vehicle with GPS integration
πŸ’° Start earning within 48 hours

Join as a Partner Today

It’s simple, safe, and rewarding. Your vehicle. Your rules. Your earnings.

Laravel 5.5 php artisan migrate error in Ubuntu: SQLSTATE[HY000] [2002] Connection refused

How I got this error?
Ans: I was running php artisan migrate command in /opt/lampp/htdocs/project_dir

What was the error?
ubuntu@ip-ip_addr:/opt/lampp/htdocs/project_dir$ php artisan migrate
In Connection.php line 664:

SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = db_name and table_name = migrations
)

In Connector.php line 67:

SQLSTATE[HY000] [2002] Connection refused

Screenshot of the error:

Solution:
1. Open .env file
2. Change the DB_HOST=127.0.0.1 to DB_HOST=localhost
3. Make sure the port number, db name, username and password is correctly mention in the .env before saving it
4. Save the .env file then run command: sudo artisan config:cache
5. Now, run command: php artisan migrate

Output after applying the solution:

Thanks for reading. I hope you enjoyed the article!

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.