Why won't mySQL start? - mysql

I've tried many things said on the internet, also tried to fix it myself, but I don't have any clue, what I could do next. I can't Reinstall it, because there is important data on it.
The log:
htts://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2022-12-31 0:32:28 2 [ERROR] InnoDB: Page [page id: space=24, page number=1] log sequence number 300669 is in the future! Current system log sequence number 300459.
2022-12-31 0:32:28 2 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to htts://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2022-12-31 0:32:28 0 [Note] InnoDB: 10.4.27 started; log sequence number 300450; transaction id 214
2022-12-31 0:32:28 0 [Note] InnoDB: Loading buffer pool(s) from C:\xampp\mysql\data\ib_buffer_pool
2022-12-31 0:32:28 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-12-31 0:32:28 0 [Note] Server socket created on IP: '::'.
I've tried updateing the config.
I've tried booting without password.

There are currently two methods:
Modify the value of innodb_force_recovery in the parameter file, and then start the database. If it succeeds, you need to export the data, then recreate the database, and then import the data. If not, refer to the second point.
There are some tools, some paid and some free. You can retrieve the data through the ibdata file, and rebuild the database after retrieval.
Of course it is very important not to delete the data files

Related

Xampp MySql Error: MySQL shutdown unexpectedly

my Xampp MySql won't start. Elsewhere in this forum was has been advised to change the file name C:\xampp\mysql\data\ibdata1 to ibdata1.bak and turn off the Xampp. But it did not help. Is there a way to fix this?
2020-09-17 17:19:47 2 [ERROR] InnoDB: Page [page id: space=33, page number=1] log sequence number 402782 is in the future! Current system log sequence number 47064.
2020-09-17 17:19:47 2 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2020-09-17 17:19:47 0 [Note] InnoDB: 10.4.11 started; log sequence number 47055; transaction id 347965
2020-09-17 17:19:47 0 [Note] InnoDB: Loading buffer pool(s) from C:\xampp\mysql\data\ib_buffer_pool
2020-09-17 17:19:47 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-09-17 17:19:47 0 [ERROR] InnoDB: Page [page id: space=0, page number=243] log sequence number 336525986 is in the future! Current system log sequence number 47064.
2020-09-17 17:19:47 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2020-09-17 17:19:47 0 [ERROR] InnoDB: Page [page id: space=0, page number=309] log sequence number 332378035 is in the future! Current system log sequence number 47064.
2020-09-17 17:19:47 0 [Note] Server socket created on IP: '::'.
2020-09-17 17:19:47 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespac
Your files (maybe log files) and the time of your PC have conflict!
log sequence number 402782 is in the future!
check your PC time and sync it with real time!
remove all files which have a date-time more than your PC date-time (if possible! if not, create a new one in a proper date). For example your PC date is 2019-xx-xx and your files is 2020-xx-xx.

Physically writing the file full - mysql Error

I am using xampp , everytime I start mysql , I get following error in xampp
Error: MySQL shutdown unexpectedly.
13:16:14 [mysql] This may be due to a blocked port, missing dependencies,
13:16:14 [mysql] improper privileges, a crash, or a shutdown by another method.
13:16:14 [mysql] Press the Logs button to view error logs and check
I checked the error logs and below is the output , I even changed port , but that is not helping.Previously I deleted ibdata by seeing some other stackoverflow answer and whole database was lost , so dont want to do that mistake.Any guide to safely fix this error ?
2019-08-07 13:16:01 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2019-08-07 13:16:01 0 [Note] InnoDB: Uses event mutexes
2019-08-07 13:16:01 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-08-07 13:16:01 0 [Note] InnoDB: Number of pools: 1
2019-08-07 13:16:01 0 [Note] InnoDB: Using SSE2 crc32 instructions
2019-08-07 13:16:01 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2019-08-07 13:16:01 0 [Note] InnoDB: Completed initialization of buffer pool
2019-08-07 13:16:01 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2019-08-07 13:16:01 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-08-07 13:16:01 0 [Note] InnoDB: Setting file 'D:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-08-07 13:16:01 0 [Note] InnoDB: File 'D:\xampp\mysql\data\ibtmp1' size is now 12 MB.
2019-08-07 13:16:01 0 [Note] InnoDB: Waiting for purge to start
2019-08-07 13:16:01 0 [Note] InnoDB: 10.3.16 started; log sequence number 1951328; transaction id 1068
2019-08-07 13:16:01 0 [Note] InnoDB: Loading buffer pool(s) from D:\xampp\mysql\data\ib_buffer_pool
2019-08-07 13:16:01 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-08-07 13:16:01 0 [Note] Server socket created on IP: '::'.
2019-08-07 13:16:01 0 [Note] InnoDB: Buffer pool(s) load completed at 190807 13:16:01
I get following error in windows events
The description for Event ID 100 from source MySQL cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
Slave I/O: Unable to load replication GTID slave state from mysql.gtid_slave_pos: Table 'mysql.gtid_slave_pos' doesn't exist in engine, Internal MariaDB error code: 1932
A simple and effective solution is:
To copy your database files ibdata1 and database folders from c:\xamp\mysql\data to a safe place as backup
Copy all your website files from c:\xamp\htdocs to a safe place as backup
Head to applications (MAC) or control panel (Windows) and uninstall the current xampp version
Download the latest xampp version and install.
Copy back your files to their respective places
Done.
Your applications should be back normal and working fine. I hope it helps someone.
If you want a faster & easier way of fixing this problem, instead of re-installing XAMPP & reconfiguring everything, then look in your /xampp/mysql/data/ folder for any files, which have these prefixes & really long file names. They will almost all have a plethora of repeating "#" symbols in their file names, like so:
master-...#...#...#..#...
multi-...#...#...#..#...
mysql-relay-bin-...#...#...#..#...
relay-log-...#...#...#..#...
If you find those files - which are not standard short table names, but rather crash dump files - then make a /backup folder & simply move them into that folder. Then you can restart MySQL through the XAMPP control panel, without it failing. That's an easy & fast fix, which I just discovered & used to solve the same problem!
Addendum: 7-24-2022
If MySQL fails to startup after deleting those files, then delete this file too:
multi-master.info
Then MySQL should startup, plus remain up & running in XAMPP.

MySql stops unexpectedly

MySql stops unexpectedly
Here is a copy of Error log:
2019-07-03 13:27:50 0 [ERROR] InnoDB: Your database may be corrupt or
you may have copied the InnoDB tablespace but not the InnoDB log
files. Please refer to
https://mariadb.com/kb/en/library/innodb-recovery-modes/ for
information about forcing recovery.
2019-07-03 13:27:50 0 [Note]
InnoDB: 128 out of 128 rollback segments are active.
2019-07-03 13:27:50 0 [ERROR] InnoDB: Page [page id: space=0, page number=305]
log sequence number 2834539 is in the future! Current system log
sequence number 1604011.
2019-07-03 13:27:50 0 [ERROR] InnoDB: Your
database may be corrupt or you may have copied the InnoDB tablespace
but not the InnoDB log files. Please refer to
https://mariadb.com/kb/en/library/innodb-recovery-modes/ for
information about forcing recovery.
2019-07-03 13:27:50 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-07-03 13:27:50 0 [Note] InnoDB: Setting file 'C:\xampp\mysql\data\ibtmp1'
size to 12 MB. Physically writing the file full; Please wait ...
2019-07-03 13:27:50 0 [Note] InnoDB: File 'C:\xampp\mysql\data\ibtmp1'
size is now 12 MB.
2019-07-03 13:27:50 0 [Note] InnoDB: Waiting for purge to start
2019-07-03 13:27:50 0 [Note] InnoDB: 10.3.16 started;
log sequence number 1604002; transaction id 1432
2019-07-03 13:27:50 0 [Note] InnoDB: Loading buffer pool(s) from
C:\xampp\mysql\data\ib_buffer_pool
2019-07-03 13:27:50 0 [ERROR] InnoDB: Page [page id: space=0, page number=9] log sequence number
2841120 is in the future! Current system log sequence number 1604011.
2019-07-03 13:27:50 0 [ERROR] InnoDB: Your database may be corrupt or
you may have copied the InnoDB tablespace but not the InnoDB log
files. Please refer to
https://mariadb.com/kb/en/library/innodb-recovery-modes/ for
information about forcing recovery.
2019-07-03 13:27:50 0 [ERROR] InnoDB: Page [page id: space=0, page number=243] log sequence number
2082633 is in the future! Current system log sequence number 1604011.
2019-07-03 13:27:50 0 [ERROR] InnoDB: Your database may be corrupt or
you may have copied the InnoDB tablespace but not the InnoDB log
files. Please refer to
https://mariadb.com/kb/en/library/innodb-recovery-modes/ for
information about forcing recovery.
2019-07-03 13:27:50 0 [ERROR] InnoDB: Page [page id: space=1, page number=0] log sequence number
1608629 is in the future! Current system log sequence number 1604011.
2019-07-03 13:27:50 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-07-03 13:27:50 0 [ERROR] InnoDB: Your database may be corrupt or you may
have copied the InnoDB tablespace but not the InnoDB log files. Please
refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for
information about forcing recovery.
2019-07-03 13:27:50 0 [ERROR] InnoDB: Page [page id: space=1, page number=1] log sequence number
1604111 is in the future! Current system log sequence number 1604011.
2019-07-03 13:27:50 0 [ERROR] InnoDB: Your database may be corrupt or
you may have copied the InnoDB tablespace but not the InnoDB log
files. Please refer to
https://mariadb.com/kb/en/library/innodb-recovery-modes/ for
information about forcing recovery.
2019-07-03 13:27:50 0 [Note] Server socket created on IP: '::'.
2019-07-03 13:27:50 0 [ERROR] InnoDB: Page [page
What can I do to get my database up and running again?
All help is greatly appreciated!
I have faced the same problem. I just followed the below steps
Step 1: Moved(cut/paste) all the files in C:\xampp\mysql\data to desired backup location.
Step 2: After that copied all the files from C:\xampp\mysql\backup to C:\xampp\mysql\data
Step 3: Restarted mysql and checked the phpmyadmin url, it worked.
Step 4: After that stopped mysql and copied ibdata1 file from backup location to C:\xampp\mysql\data
Step 5: Restarted mysql
Step 6: After that copied all database folders and checked all the tables, It worked.
I also faced this issue and searched a lot only one solution worked for me.
Just copy all files from C:\xampp\mysql\backup to C:\xampp\mysql\data
Make sure to take backup of your data folder to avoid any further problems.
If you see any error related to table engine then you can copy file ibdata1 from your backup data folder to current data folder
Seems that there is corruption in MySQL log and/or data files, one way to workaround this problem is to start MySQL in recovery mode.
From my.ini in windows (or my.cnf in Linux) add the following line:
innodb_force_recovery=1 under [mysqld] section then re-start MySQL service.
If the problem persisted, mysqlcheck can help, move to the folder where MySQL binaries exist in your machine, and in Command Line execute ./mysqlcheck.exe --all-databases this will list tables that are corrupted
Reference:
https://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
Just Unintall XAMPP and the reinstall it , it will resolve all the issue , but make sure to have the backup of your MYSQL database.
If your backup folder doesn't include your latest DB changes and you are stuck with collation of in use, then do this instead:
Install another XAMPP instance in new folder;
Copy the single folder of: [old_xampp]/mysql/data/[table_name]/ into [new_xampp]/mysql/data/;
Copy a file from: [old_xampp]/mysql/data/ibdata1 to: [new_xampp]/mysql/data/ibdata1 and replace it;
Stop old XAMPP;
Run new XAMPP.
DONE!
All your new table entries should be brought back.

Trouble with MySQL - InnoDB: Operating system error number 2 in a file operation

I'm developing locally and using Mamp Pro.
Basically MySQL is having trouble starting and here's the error message from the error log:
Any idea how to resolve this?
2017-03-02 00:39:08 9518 [Note] Plugin 'FEDERATED' is disabled.
2017-03-02 00:39:08 9518 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-03-02 00:39:08 9518 [Note] InnoDB: The InnoDB memory heap is disabled
2017-03-02 00:39:08 9518 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-02 00:39:08 9518 [Note] InnoDB: Memory barrier is not used
2017-03-02 00:39:08 9518 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-03-02 00:39:08 9518 [Note] InnoDB: Using CPU crc32 instructions
2017-03-02 00:39:08 9518 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-03-02 00:39:08 9518 [Note] InnoDB: Completed initialization of buffer pool
2017-03-02 00:39:08 9518 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-02 00:39:08 9518 [Note] InnoDB: Log scan progressed past the checkpoint lsn 663573438
2017-03-02 00:39:08 9518 [Note] InnoDB: Database was not shutdown normally!
2017-03-02 00:39:08 9518 [Note] InnoDB: Starting crash recovery.
2017-03-02 00:39:08 9518 [Note] InnoDB: Reading tablespace information from the .ibd files...
2017-03-02 00:39:08 9518 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta uses space ID: 367 at filepath: ./affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta.ibd. Cannot open tablespace freshwp/freshwp_wfblocksadv which uses space ID: 367 at filepath: ./freshwp/freshwp_wfblocksadv.ibd
2017-03-02 00:39:08 7fff7b652000 InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: Error: could not open single-table tablespace file ./freshwp/freshwp_wfblocksadv.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
170302 00:39:08 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
From the above code the error seems to be:
2017-03-02 00:39:08 9518 [ERROR] InnoDB: Attempted to open a previously opened tablespace.
Previous tablespace affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta
uses space ID: 367
at filepath: ./affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta.ibd.
Cannot open tablespace freshwp/freshwp_wfblocksadv which uses space ID: 367
at filepath: ./freshwp/freshwp_wfblocksadv.ibd
Recently encountered similar issue developing locally w/ MAMP. Log included "Database was not shutdown normally", similar error messages after that point, and the suggestions as well. Below are steps that resolved it:
Stop servers in MAMP
Navigate to the .idb files for your WP DB - if using MAMP, should be somewhere like ~/Library/Application Support/appsolute/MAMP PRO/db/mysql56/[yourdbname]/
Add .bk (or any unrecognizable extension) to the end of the .idb filenames
Start servers in MAMP. If you view logs, you'll see a bunch of error messages related to not finding the .idb files, but at least MySQL should start.
Stop servers in MAMP
Drop the .bk (or whatever you used) from the .idb file names
Start servers in MAMP - at this point, should be all set.
Hadn't yet done much work with the DB, so was willing to lose data or even reinstall MAMP; if your situation is different, probably best to first backup your db directory to a .zip file so you can try something else later if no luck.
Hope this helps.
....
UPDATE:
Have found it faster to replace steps 3 and 6 with the following:
3. Create a temporary folder somewhere handy; select all the .idb files and move them into that folder.
6. Move the files back into the original folder from Step 2.
....

mysql not working , it is not starting

here is a bit of the error log .
160422 10:45:00 [Note] InnoDB: The log sequence numbers 1665244 and 1665244 in ibdata files do not match the log sequence number 15857945 in the ib_logfiles!
160422 10:45:00 [Note] InnoDB: Database was not shutdown normally!
160422 10:45:00 [Note] InnoDB: Starting crash recovery.
160422 10:45:00 [Note] InnoDB: Reading tablespace information from the .ibd files...
160422 10:45:00 [Note] InnoDB: Restoring possible half-written data pages
160422 10:45:00 [Note] InnoDB: from the doublewrite buffer...
160422 10:45:00 [Note] InnoDB: 128 rollback segment(s) are active.
160422 10:45:00 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.22-72.0 started; log sequence number 15857945
160422 10:45:00 [Note] InnoDB: !!! innodb_force_recovery is set to 2 !!!
160422 10:45:00 [Note] Plugin 'FEEDBACK' is disabled.
160422 10:45:00 [Note] Server socket created on IP: '::'.
160422 10:45:00 [ERROR] mysqld.exe: Table '.\mysql\db' is marked as crashed and last (automatic?) repair failed
160422 10:45:00 [ERROR] Fatal error: Can't open and lock privilege tables: Table '.\mysql\db' is marked as crashed and last (automatic?) repair failed
plz somebody help , i have one important database ,whose backup i have not made , i posted this question earlier ,but didnt got the answer ...this started when i was trying to access phpmyadmin , from then on mysql is not starting.
I see two potential ways out of it.
For the following:
Table '.\mysql\db' is marked as crashed and last (automatic?) repair failed
You can use mysqlcheck to repair it, if it is a MyISAM DB. Else try the InnoDB force recovery option if it is InnoDB database. You can start your DB with InnoDB force recovery and take a DB dump from it, to restore it on a fresh MySQL install.
In future, try enabling innodb_file_per_table option.
Now, second option. Even though the first one looks most likely.
The log sequence numbers 1665244 and 1665244 in ibdata files do not match the log sequence number 15857945 in the ib_logfiles!
If the first method doesnt work, give this a try. It looks like the ib_logfiles are corrupt, I faced this issue before and used the following steps to get my DB up and working:
Take a full backup of your mysql datadir in another directory.
Make sure mysql service is stopped.
remove the ib_logfile1 and ib_logfile2
Start the MySQL service
Hope it helps
Rishav, innodb_force_recovery doesn't recover anything. It is a mode you start your mysql with. Once it starts, you should be able to take a dump. Following should be the steps:
Steps to get it back up.
1. Stop mysqld.
2. Backup /var/lib/mysql/ib*
3. Add the following line into /etc/my.cnf
innodb_force_recovery = 4
4. Restart mysqld.
5. Dump your DB using mysqldump to a dump.sql file.
6. Drop all databases which need recovery.
7. Stop mysqld.
8. Remove /var/lib/mysql/ib*
9. Comment out innodb_force_recovery in /etc/my.cnf
10. Restart mysqld. Look at mysql error log. By default it should be /var/lib/mysql/server/hostname.com.err to see how it creates new ib* files. (Although, I recommend a fresh setup here)
11. Restore databases from the dump:mysql < dump.sql