Sign in

I wrote these tutorials for myself in future when I forget for the next steps.

By default we can’t have a direct URL or link to go to a page in adminhtml without being redirected to dashboard. But, there is a module to handle this requirement called Magento2 AdminUrl.

There is documentation in the docs, feel free to report issues or maybe any suggestion for the next version.

Update password can be done via mysql query, simply just execute this query to update customer’s password :

UPDATE customer_entity SET password_hash = CONCAT(SHA2('xxxxxxxTypeYourPasswordHere', 256), ':xxxxxxx:1') WHERE email = '';

And this query for admin :

UPDATE admin_user SET password = CONCAT(SHA2('xxxxxxxTypeYourPasswordHere', 256), ':xxxxxxx:1') WHERE email = '';

Notes :

  • Change TypeYourPasswordHere by new password without removing xxxxxxx
  • Change by email of customer/admin.

We have this running container, and wa re going to change the binded container port from 9212 to 9200.

1. Stop running container.

Stop the running container which you want to edit, in my case it is mgt-dev-71. So I run this command :

docker stop mgt-dev-71

2. Go to docker containers directory.

For linux open up your terminal and go to /var/lib/docker/containers/

For windows or linux, you can follow this step to access /var/lib/docker/containers/ :

3. Edit hostconfig.json.

Change directory to where your container directory which is the container ID. In my case, it is 610d6949f329.

Edit hostconfig.json

Are you facing the problem that when you filter the result, and clear the filter, then you found your rows are same? Or are you facing this problem when you go to next page, and went back to previous page?

This problem maybe is because you have another primary id than what magento usually used, that is entity_id. So you need to replace the primary id to your primary id on your listing xml and inside your data provider syntax. e.g. …

Once you have installed magento 2 project and you’d like to remove index.php from your address. Maybe from https// to, you can easely turn On the configuration under stores > configuration > general > web > Search Engine Optimization > Use Web Server Rewrites.

Clean your cache! And voila you have your index.php disappeared from URL.

Actually you can not access your hypervisor, but you can have another way to access it by creating a container that syncing to hyper-v.

Just follow this step by run this command on your windows powershell or your osx terminal :

docker run --rm -it -v /:/host alpine

Once the process finish, and you are on linux / alpine terminal, run this :

chroot /host

Voila… you are on your MobyLinux terminal, and you can cusomize everything on it.

If you are facing this error once you are trying to execute npm start, it’s because of your `max_user_watches` was reached the maximum number. Simply you can increase the `max_user_watches` by running this command :

$ echo fs.inotify.max_user_watches=288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

And then you can run npm start again, and voila :

Once you updated your xml to update the sortOrder, but it is not working, maybe it is because of cache or bookmark of the account.

So, the simple solution is to clean up ui_bookmark table, then cache:flush, then refresh the page.

Simple way to delete all bookmark is by truncate table : truncate ui_bookmark. Truncate is the simple way of drop table, and then create new table.

Check domysqld.sock and exist or not. If not, inside the docker terminal, run these commands :

sudo touch /var/run/mysqld/mysqld.sock
sudo touch /var/run/mysqld/
sudo chown -R mysql:mysql /var/run/mysqld/mysqld.sock
sudo chown -R mysql:mysql /var/run/mysqld/
sudo chmod -R 644 /var/run/mysqld/mysqld.sock

Then, restart mysql service :

sudo service mysql restart

Still, if your mysql can’t connect to mysql. Run this method and restart the service of mysql (maybe you also need to restart the container if still can’t connect to mysql) :

sudo chown -R mysql:mysql /var/lib/mysql /var/run/mysqld

By Default, if you want to request thru post method, you need to need to decide this on Header Request :

X-Requested-With: XMLHttpRequest

Problem here is, what if we won’t include that header?

1. Use the classes

Use this classes by putting on top of class

use Magento\Framework\App\CsrfAwareActionInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\App\Request\InvalidRequestException;

2. Implements `CsrfAwareActionInterface` Interface

Impletements this interface to the controller :

class Paymentflag extends \Magento\Framework\App\Action\Action implements CsrfAwareActionInterface

3. Add Methods

Edit your Controller by adding this methods to allow that request :

public function createCsrfValidationException(RequestInterface $request): ? InvalidRequestException
return null;

public function validateForCsrf(RequestInterface $request): ?bool
return true;

4. Finished

Go get the request without header.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store