I have school database who having more then 80 000 records and I want to update and insert into my newSchool database using php, whenever I try to run query update or insert almost 2 000 records and after some time its stopped automatically please help
You could (should) do a full dump and import that dump later. I'm not sure how to do it with php - and think you'd be better doing this with those commands on the cli:
mysqldump -u <username> -p -A -R -E --triggers --single-transaction > backup.sql
And on your localhost:
mysql -u <username> -p < backup.sql
The backup statement flags meanings from the docs:
-u
DB_USERNAME
-p
DB_PASSWORD
Don't paste your password here, but enter it after mysql asks for it. Using a password on the command line interface can be insecure.
-A
Dump all tables in all databases. This is the same as using the --databases option and naming all the databases on the command line.
-E
Include Event Scheduler events for the dumped databases in the output. This option requires the EVENT privileges for those databases.
The output generated by using --events contains CREATE EVENT statements to create the events. However, these statements do not include attributes such as the event creation and modification timestamps, so when the events are reloaded, they are created with timestamps equal to the reload time.
If you require events to be created with their original timestamp attributes, do not use --events. Instead, dump and reload the contents of the mysql.event table directly, using a MySQL account that has appropriate privileges for the mysql database.
-R
Include stored routines (procedures and functions) for the dumped databases in the output. Use of this option requires the SELECT privilege for the mysql.proc table.
The output generated by using --routines contains CREATE PROCEDURE and CREATE FUNCTION statements to create the routines. However, these statements do not include attributes such as the routine creation and modification timestamps, so when the routines are reloaded, they are created with timestamps equal to the reload time.
If you require routines to be created with their original timestamp attributes, do not use --routines. Instead, dump and reload the contents of the mysql.proc table directly, using a MySQL account that has appropriate privileges for the mysql database.
--single-transaction
This option sets the transaction isolation mode to REPEATABLE READ and sends a START TRANSACTION SQL statement to the server before dumping data. It is useful only with transactional tables such as InnoDB, because then it dumps the consistent state of the database at the time when START TRANSACTION was issued without blocking any applications.
If you only need the data and don't need routines nor events, just skip those flags.
Be sure to do commit after a few commands, for example after 500 rows. That save memory but has the problem that in case of rollback only going back to the last commit.