PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 22, 2022

[FIXED] Importing a Laravel Project's Mysql Database

 February 22, 2022     database, laravel, mysql, phpmyadmin, sql     No comments   

Issue

I'm migrating my Laravel project to another computer. Project files have been migrated but i have some issues on migrating the database.

I exported my database through phpmyadmin (windows 7, xampp version 7.3.0) and imported to the new computer (ubuntu, xampp version 7.3.2-0).

When i try to import the .sql file, i get this error:

Static analysis:

1 errors were found during analysis.

    Missing expression. (near "ON" at position 25)

SQL query: Edit Edit

SET FOREIGN_KEY_CHECKS = ON;

MySQL said: Documentation
#2006 - MySQL server has gone away

I tried to inspect what is the matter and checked the file but on 25th line there is nothing but straight comment line like so:

-- --------------------------------------------------------

Besides that, there is also a warning below error, which is pretty long so i'll share only part of it.

Warning in ./libraries/classes/Dbi/DbiMysqli.php#213
Error while sending QUERY packet. PID=7892

Backtrace

./libraries/classes/Dbi/DbiMysqli.php#213: mysqli_query(
,
string 'INSERT INTO `items` (`id`, `title`, `type`, `alternative`, `description_html`, `view_count`, `created_at`, `updated_at`, `thumbnail`, `file`) VALUES (3, \'test book 3\', \'book\', \'someurl.com\', \'<b>cool2</b>\', 0, \'2019-01-07 18:41:33\', \'2019-01-07 18:41:33\', 

And bunch of numbers.

Any help or idea is appreciated. Thank you

What i've tried so far:

-Tried to disable "foreign key check" and it didn't help.

-Tried to run .sql file content through phpmyadmin sql tab. Pasted the sql queries. Got almost the same error :"SET FOREIGN_KEY_CHECKS = ON"

-Tried to import data and structure separately, got a different error. "max_allowed_package_size". So i did increase the size from 1mb to 10 mb to match the size. Worked.

-Then i did import the original export file after increasing max package size. Worked like charm.


Solution

Tried to import data and structure separately, got a different error. "max_allowed_package_size". So i did increase the size from 1mb to 10 mb to match the size. Worked.

Then i did import the original export file after increasing max package size. Worked like charm.

Conclusion: problem was about max allowed package size. Increased it through conf file.



Answered By - Skywarth
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing