MySql server logs error after installation - mysql

I have installed MySql fresh installation version 5.17.9
Mysql services started nicely and giving good throughput
But in server logs, I got this type of error:
InnoDB: Cannot open table mysql/engine_cost from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/gtid_executed from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/help_category from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/help_keyword from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/help_relation from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/help_topic from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/innodb_index_stats from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/innodb_table_stats from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/plugin from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/server_cost from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/servers from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/slave_master_info from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/slave_relay_log_info from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/slave_worker_info from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/time_zone from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/time_zone_leap_second from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/time_zone_name from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/time_zone_transition from the internal data dictionary of InnoDB though the .frm file for the table exists.
Cannot open table mysql/time_zone_transition_type from the internal data dictionary of InnoDB though the .frm file for the table exists.
Please help me how to fix such issues without restoring database from dump?

As you said its a fresh install, but it doesn't look so.. maybe the cause is not known :P
Solution is to delete those .frm files manually (they are often called orphan files).
For more info..
see this link
and this answer too

Related

MySQL InnoDB Error 1034 Incorrect key file for table 'tableName'; try to repair it

I'm using InnoDB engine for MySQL and file_per_table setting is set, suddenly two of the .ibd files got corrupted and their size became zero Byte, now I managed to recover old version of these two .ibd files and I do these steps to recover my data
1- create an empty database
2- create a table the same as corrupted one
3- use "ALTER TABLE tableName DISCARD TABLESPACE"
4- copy the recoverd .ibd file in the data folder
5- use "ALTER TABLE tableName IMPORT TABLESPACE"
but it gives me this error
Error (1034): Incorrect key file for table 'tableName'; try to repair it
and when I try to repair it using REPAIR TABLE tableName;or even with
mysqlcheck -r -u root -p databaseName
`it gives me this error
The storage engine for table does not support repair
You took wrong approach to recover the table. The file's size became zero because of file system inconsistencies.
You don't need the ibd file, you need the data in it. So recover the data, not the file.
As we discussed you should scan the disk with page_parser and then extract records from InnoDB pages (constraints_parser from same toolkit).

When myd files will be created in MYSQL?

I am facing an issue which is,
java.sql.SQLException: Can't create/write to file 'xxxxx.MYD' (Errcode: 13)
But it has already executed some Alter queries.
My Question is, This error occurs because of permission(which is not enough to write a file), then how the another queries has executed?
.MYD is data file in myisam ENGINE tables as myisam tables contains 3 kind of files.
.frm : schema definition
.myd : data
.myi : index
First of all check if that is myisam file on which you execute alter and other updation at the time of this error or innodb.
Are u still getting this error or it was temporary at that time.
mysql has permission on your data directory as well /tmp partition.

Can't create a table in MySQL because "it already exists"

I am having an issue with MySQL, relating to my previous question.
I recently needed to remove a table from MySQL, and now need to create a new one in its place. I am having a hard time with this because, as MySQL Workbench says, "The table already exists." Since the error from MySQL Workbench is not particularly helpful, here's some stuff that I pulled out of my error log. What's the problem?
I am running MySQL 5.7 on Windows 8.1 Pro x64.
2014-03-06T01:38:55.459658Z 0 [ERROR] InnoDB: Table thepwf_prgminteractions/p2p_messagedata in the InnoDB data dictionary has tablespace id 25, but tablespace with that id or name does not exist. Have you deleted or moved .ibd files? This may also be a table created with CREATE TEMPORARY TABLE whose .ibd and .frm files MySQL automatically removed, but the table still exists in the InnoDB internal data dictionary.
InnoDB: Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html
InnoDB: for how to resolve the issue.
2014-03-06T01:38:55.464671Z 0 [ERROR] InnoDB: Table thepwf_prgminteractions/p2p_onlineusers in the InnoDB data dictionary has tablespace id 26, but tablespace with that id or name does not exist. Have you deleted or moved .ibd files? This may also be a table created with CREATE TEMPORARY TABLE whose .ibd and .frm files MySQL automatically removed, but the table still exists in the InnoDB internal data dictionary.
InnoDB: Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html
InnoDB: for how to resolve the issue.
2014-03-06T01:38:55.468672Z 0 [ERROR] InnoDB: Table thepwf_prgminteractions/p2pchat_betaaccesskeys in the InnoDB data dictionary has tablespace id 24, but tablespace with that id or name does not exist. Have you deleted or moved .ibd files? This may also be a table created with CREATE TEMPORARY TABLE whose .ibd and .frm files MySQL automatically removed, but the table still exists in the InnoDB internal data dictionary.
As the table exists then just remove it with drop table (http://dev.mysql.com/doc/refman/5.6/en/drop-table.html)
i.e.
drop table <table name>
You must have done something wrong as the table still exists.
Can check this with select
i.e.
select * from <table name>
It looks your innodb tablespace has been corrupted.
Checkout this post from percona
http://www.mysqlperformanceblog.com/2008/07/04/recovering-innodb-table-corruption/
And these tools
http://www.percona.com/software/percona-toolkit
They will save you!
Well I don't know how well they run on windows but what the tools do should be about the same.
Go to where your mysql folder is installed:
C:\Apps\mysql-5.6.25-win64\data\databasename
Under databasename you will find your tablename. Delete this table manually and create it again using SQL Create Table command.

How to restore Innodb database?

I physically moved the database and now I am not able to restore Innodb database.
I am getting this error-
140131 13:03:41 [ERROR] Cannot find or open table table_t1/t1#P#p0 from
the internal data dictionary of InnoDB though the .frm file for the
table exists. Maybe you have deleted and recreated InnoDB data
files but have forgotten to delete the corresponding .frm files
of InnoDB tables, or you have moved .frm files to another database?
or, the table contains indexes that this version of the engine
doesn't support.
See http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting.html
how you can resolve the problem.
Help me to restore this db
Put it back and move it through the SQL interface (e.g. RENAME TABLE).

MySQL InnoDB database restore

I have to restore a database that has been inadvertently DROPped in MySQL 5.0. From checking the backup files, I only seem to have .FRM files to hold the database data.
Can anyone advise whether this is all I need to perform a database restore/import from the backup, or are there other files I should have to hand to complete this?
.frm files are not the data files, they just store the "data dictionary information" (see MySQL manual). InnoDB stores its data in ib_logfile* files. That's what you need in order to do a backup/restore. For more details see here.
Restoring innodb:
(assuming your data folder is C:\ProgramData\MySQL\MySQL Server 5.5\data)
Copy the folders of the databases (named after the database name) you want to restore to C:\ProgramData\MySQL\MySQL Server 5.5\data
Copy the 3 ibdata files to the data folder ex. (C:\ProgramData\MySQL\MySQL Server 5.5\data)
_ib_logfile0
_ib_logfile1
_ibdata1
Get the size of the _ib_logfile0 in MB (it should be the same as _ib_logfile1) by File Right click -> Properties
Edit the mysql config file (mysql\bin\my.ini) for the innodb_log_file_size=343M to be exactly the ibdata files size
Run
mysqld --defaults-file=mysql\bin\my.ini --standalone --console
--innodb_force_recovery=6
Now your data should be back in your database. Export them using phpmysql or any other tool
The detailed solution you can found here:
http://www.unilogica.com/mysql-innodb-recovery/ (Article in Portuguese)
Besides the flag of innodb_force_recovery, I found another solution: innodb_file_per_table, that splits InnoDB tables in each file like MyISAM tables.
In a crash recovery you can lost less data than in single file ibdata1.