Laravel 7 Digitalocean managed database error: The server requested authentication method unknown to the client

July 20, 2020

I am using Laravel 7 to do testing on DigitalOcean’s managed database cluster. Laravel connection doesn’t work, with error and I have fo find the fix that causing it. Illuminate\Database\QueryException SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client This issue has been fixed in PHP7.4, please install PHP7.4 in the Droplet. If […]

Laravel & NPM installation Steps

July 15, 2020

Create a new laravel project. $ composer create-project –prefer-dist laravel/laravel   my-project (NOTE: if you do not have composer, please install in your machine and make it global. This will make a lot easier) Or Clone the repository from github or your private repo. $ git clone <your repo> Install NPM globally if you haven’t installed that […]

PHP MySql query for random record from database table

September 5, 2014

The simplest way of selecting random rows from the MySQL database is to use “ORDER BY RAND()” clause in the query. Example:

Ubuntu phpmyadmin connect to mysql error: #2002 cannot log in to the mysql server

August 22, 2014

If phpmyadmin cannot connect to mysql error: #2002 cannot log in to the mysql server Run: sudo nano /etc/mysql/my.cnf Update bind-address = 192.168.0.2 To bind-address = localhost This fixed the problem. Enjoy. ref: here

PHP Prepare IN statement from array

April 14, 2014

Some of us may not know that when preparing mysql IN statement, the string inside the IN() need to be single quoted and separated by comma. Example: Unless it is a number. Otherwise double quote or no quoting the string will give you error. Example: WHERE categories IN (“red”, “blue”, “green”) To prepare IN statement […]

Ubuntu check PHP and mysql version

April 7, 2014

From command line: php -v mysql -V or php -i | grep -i ‘^libxml’

MySQL modify field value allow NULL

December 19, 2013

Columns are nullable by default. As long as the column is not declared UNIQUE or NOT NULL . However, things may change during development or to prevent insert error. Thus, run this comman, example: