When myd files will be created in MYSQL? - 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.

Related

MySql server logs error after installation

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

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).

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).

MYSQL5.5 INNODB optimazation

looking to optimize mysql5.5 databases for INNODB. I have tried the link
Note: The databases also contains MYISAM tables.
Howto: Clean a mysql InnoDB storage engine?
As per the instructions I have dropped all databases as well as ibdata* and ib_logfile* and made changes in my.cnf like
[mysqld]
innodb_file_per_table
innodb_flush_method=O_DIRECT
innodb_log_file_size=1G
innodb_buffer_pool_size=4G
Now on restoring the backup, not only mysql storing INNODB tables in separate files, but it is doing it for MYISAM tables as well.
This is resulting in MYISAM database unusable.
when I am trying to access the website having MYISAM tables I am getting the error - Error displaying the error page: Application Instantiation Error
Can't makeout why mysql is storing MYISAM tables in separate files.
Thanks.
AFAIK MyISAM always stores tables in their own files (3 files per table: .MYI, .MYD and .frm).
It is not allowed to remove the ibdata file. Do you have a backup of that file? To move from single file to file per table you need to do as stated here: http://dev.mysql.com/doc/refman/5.0/en/innodb-multiple-tablespaces.html (see under "Enabling and Disabling Multiple Tablespaces")

MySQL db had disappeared how to track what happened?

Two days ago I have installed RoundCube mail script working on:
PHP
Name : php
Arch : x86_64
Version : 5.3.18
Release : 1.el6.remi
MySQL
Name : mysql
Arch : x86_64
Version : 5.5.28
Release : 1.el6.remi
Anything worked just great till today morning, script refers that Round Cube database has problems. How wonder was I am looking at directory:
/var/lib/mysql/roundcubemail
There is only frm files, no any .myd or .myi
cache.frm
cache_index.frm
cache_messages.frm
cache_thread.frm
contactgroupmembers.frm
contactgroups.frm
contacts.frm
db.opt
dictionary.frm
identities.frm
searches.frm
session.frm
users.frm
My server has 12 databases and now only Round Cube db missing .myd .myi files. Re-install this script is not a problem but I am interesting to figure out what was happened to this database and to be sure that it will not going to happen again.
MySQL error log has only this information:
121117 7:38:06 [ERROR] Cannot find or open table roundcubemail/session 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.
My question is: Is there any other methods to track this situation and find the reason that database just had disappeared?
.myd and .myi files only exist for MyISAM tables.
If you followed the standard Roudcube installation procedure (verified with v0.8.4), tables were set to use the InnoDB storage engine.
Have you messed with any file under /var/lib/mysql/ ? By default, InnoDB tables are stored in one single file, probably /var/lib/mysql/ibdata1 in your case. If not, look for the innodb_data_file_path directive in your my.cnf configuration file.