Tag Archives: MySQL

magento 2 unable to unserialize value

Open the file \vendor\magento\framework\Serialize\Serializer\json.php and replace the function unserialize() with the below

public function unserialize($string) {
/* Added the following if clause to resolve the issue */
$string = $this->serialize($string);
$result = json_decode($string, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \InvalidArgumentException('Unable to unserialize value.');
return $result;

Also add the following function as well

function is_serialized($value, &$result = null) {
// Bit of a give away this one
if (!is_string($value))
return false;
// Serialized false, return true. unserialize() returns false on an
// invalid string or it could return false if the string is serialized
// false, eliminate that possibility.
if ($value === 'b:0;')
$result = false;
return true;
$length = strlen($value);
$end = '';
switch ($value[0])
case 's':
if ($value[$length - 2] !== '"')
return false;
case 'b':
case 'i':
case 'd':
// This looks odd but it is quicker than isset()ing
$end .= ';';
case 'a':
case 'O':
$end .= '}';
if ($value[1] !== ':')
return false;
switch ($value[2])
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
return false;
case 'N':
$end .= ';';
if ($value[$length - 1] !== $end[0])
return false;
return false;
if (($result = @unserialize($value)) === false)
$result = null;
return false;
return true;

Magento 2: setup upgrade error “We can’t find the role for the user you wanted”

open the file
vendor/magento/module-authorization/Model/Acl/AclRetriever.php and replaced the below code

if (!$role) {
throw new AuthorizationException(
__('We can\'t find the role for the user you wanted.')
$allowedResources = $this->getAllowedResourcesByRole($role->getId());


if (!$role) {
$allowedResources = array();

and revert it on sucess.

check last executed query mysql

You can controll this option at run time.

If you prefer to output to a table:

Execute SET GLOBAL log_output = 'TABLE';
Execute SET GLOBAL general_log = 'ON';
Take a look at the table mysql.general_log

If you prefer to output to a file instead of a table:

SET GLOBAL log_output = "FILE"; the default.
SET GLOBAL general_log_file = "/path/to/your/logfile.log";
SET GLOBAL general_log = 'ON';

Import a large sql dump file

1) Set network buffer length to a large byte number. The default value may throw errors for such large data files

set global net_buffer_length=1000000;

2) Set maximum allowed packet size to a large byte number.The default value may throw errors for such large data files.

set global max_allowed_packet=1000000000;

3) Disable foreign key checking to avoid delays,errors and unwanted behaviour

SET foreign_key_checks = 0;

4) Import your sql dump file


5) Enable foreign key checks when import is done.

SET foreign_key_checks = 1;
innodb_buffer_pool_size    = 1G
innodb_log_buffer_size = 1G
innodb_write_io_threads = 16
innodb_flush_log_at_trx_commit = 0
innodb_log_file_size = 1G

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver on eclipse

You need to add jar file to build path

right click on project->build path->configure build path->libraries tab ->add external jar

browse it and add it.

after adding also if u not getting same error, then

You must include the jar file in the Deployment Assembly of the Project.

1)select the web project which contains the jsp file

2)select Project tab in the menubar in Eclipse

3)select properties in the drop down menu

4)select Deployment Assembly

5)Add your ojdbc6.jar file in it..