Dealing with core Cache in Drupal 8

At this point, if you try to login in the Drupal 8 website you will be rejected, it’s because the login system doesn’t read directly the table users_field_data instead of a cache for entities is used.

To flush the cache for a specific user entity with compromise the rest of cache of your system you can use the following SQL statement.

DELETE FROM cache_entity WHERE cid = ‘values:user:1’;

Now you can grab a cup of coffee/tea and enjoy your Drupal 8 website.

Hope this will help you.

 

Resetting the administrator password with SQL-query in Drupal 8

It’s has been happening, that we tend to forget password on local as well for the live site. When it’s come to Drupal 8 all things has things changed from the prior version of Drupal.

Here we go with some of the tricks for Drupal 8.

The Solution
Generate a new password
First, you have to generate a password hash that is valid for your site.

Execute the following commands from the command line, in the Drupal 8 root directory:

$ php core/scripts/password-hash.sh ‘your-new-pass-here’

password: your-new-pass-here    hash: $S$EV4QAYSIc9XNZD9GMNDwMpMJXPJzz1J2dkSH6KIGiAVXvREBy.9E

Update the user password.

Now you need to update the user password, in our case, we need to update the Administrator password, fortunately, the UID for Administrator is 1 equal to previous versions of Drupal.

With the new password, we need run the following SQL statement.

UPDATE users_field_data SET pass=’$S$E5j59pCS9kjQ8P/M1aUCKuF4UUIp.dXjrHyvnE4PerAVJ93bIu4U’ WHERE uid = 1;

We all set with password update and go… log in!

Getting Rid Of Magento ReIndexing Errors

If even after trying multiple times Magento Indexer fails to respond or keep throwing same errors you can take the following steps resolve Magento ReIndexing errors.

1. Locate var/locks directory and remove all files under this directory. This will clear all the locks for re-indexing to take place again.

2. Now, login to your MysQSL/phpMyAdmin to run the following MySQL query (Ensure that your have taken full backup before committing this MySQL que

DELETE cpop.* FROM catalog_product_option_price AS cpop
INNER JOIN catalog_product_option AS cpo
ON cpo.option_id = cpop.option_id
WHERE
cpo.type = ‘checkbox’ OR
cpo.type = ‘radio’ OR
cpo.type = ‘drop_down’;

DELETE cpotp.* FROM catalog_product_option_type_price AS cpotp
INNER JOIN catalog_product_option_type_value AS cpotv
ON cpotv.option_type_id = cpotp.option_type_id
INNER JOIN catalog_product_option AS cpo
ON cpotv.option_id = cpo.option_id
WHERE

*hope above will helps 🙂

File system and mysql backup on shared hosting

Create two php files and upload to server. Following script will compress your files and able to take mysql backup in gzip format.

Before this create phpinfo.php file and add following code.

<?php

phpinfo();

?>

gzipfile.php
<?php
$Command = 'tar -czf /public_html/content/html/website.tgz /public_html/content/html';
exec($Command, $output, $result);
if($result > 0) {
echo 'Command not executed. ';
echo 'Error Details:'.$output;
} else {
echo 'Command executed sucesfully.';
}
?>

create mysqlbackup.php  file and add following lines.

<?php
$Command = 'mysqldump -udbusername -pdbpassword -hyour_database_hostname DBname | gzip > DBname.gz';

exec($Command, $output, $result);
if($result > 0) {
echo 'Command not executed. ';
echo 'Error Details:'.$output;
} else {
echo 'Command executed sucesfully.';
}
?>