MySQL 5.1 InnoDB file-per-table option - mysql

My application uses MySQL 5.1.49 as its main DB.
The default table engine for my version of MySQL is MyISAM, but since I want to use InnoDB (which is the default engine for version 5.5 and higher), I have to specify the following line in the end of each CREATE TABLE statement:
ENGINE = InnoDB DEFAULT CHARACTER SET 'utf8' COLLATE 'utf8_bin';
I need to save a specific table in a different location within the file system. I turned on the file-per-table option, and added the DATA DIRECTORY flag.
MySQL ignores the DATA DIRECTORY flag when the active engine is InnoDB.
If I remove the InnoDB statement (thus forcing it to work with the default engine, MyISAM), it works, but then I lose all the advantages of the InnoDB engine.
Is there a way to combine them both WITHOUT upgrading to MySQL 5.5?
Thanks

No, the DATA DIRECTORY option is not supported for InnoDB until MySQL 5.6. The only way to achieve what you want would be to use symlinks at the filesystem level, but this is very dangerous and not recommended.

Related

how import a mysqldump without ENGINE specified in MyISAM

all my sqldumps are without the "Engine=..." syntax in the CREATE Statements, so
maybe i can somehow add "ENGINE=MyISAM" to the default import?
because on my ubuntu 12.04 server with mysql 5.5 importing a large table is very slow, because it is using the standard InnoDB when i just import it
or can i set a settings flag in mysql, that new tables created are MyIsam as default?
To set the default engine to MyISAM, use the following configuration option in my.cnf:
default-storage-engine=MyISAM
According to the docs, you can:
start the server with a specified default storage engine:
You can specify the default engine by using the --default-storage-engine server startup option,
change the config file
or by setting the default-storage-engine option in the my.cnf configuration file.
change the engine on a session by session basis
You can set the default storage engine to be used during the current session by setting the default_storage_engine variable

MySQL database engine: MyISAM for information_schema but InnoDB for other databases

I am currently using InnoDB for all my databases in MySQL, however I just noticed that my information_schema database uses MyISAM for tables that are not MEMORY.
I am in the process of investigating an InnoDB/MyISAM issue. While I don't think this is the cause of it, I am worried about this mixing. The database was originally set up with MyISAM. Later the my.cnf file was updated to reset the engine to InnoDB. I am using MySQL 5.5.10.
What are the possible issues that could occur with having your information_schema database set to MyISAM, but all your other databases set to MySQL?
For those looking for help:
If you came across this question in search of an answer or you want to know more, to see your default database engine:
show variables;
To see the engine assigned to tables in a database:
show table status;
My my.cnf settings:
[client]
default-character-set=utf8
[mysqld]
log=/usr/local/var/mysql/mysqld.log
character-set-server = utf8
collation-server = utf8_general_ci
lower_case_table_names=2
default_storage_engine=InnoDB
# Performance hacks:
innodb_flush_method=nosync
innodb_flush_log_at_trx_commit=0
The storage engine used is on a per-table basis. The default storage engine is used when creating a new table and you don't specify a storage engine for the new table.
The system tables would have been MyISAM regardless of what you set the default storage engine to.
From MySQL documentation:
Important
Do not convert MySQL system tables in the mysql database (such as user
or host) to the InnoDB type. This is an unsupported operation. The
system tables must always be of the MyISAM type.
If you are not querying the information_schema tables directly, there is no concern about mixing the types.

MySQL: does MyISAM have tablespaces?

Can i create tablespaces with a MyISAM table running on MySQL 5.1.30?
Tablesspaces (in MySQL 5.1) are only supported for NDB and NDBCLUSTER, cf http://dev.mysql.com/doc/refman/5.1/en/create-tablespace.html:
The ENGINE parameter determines the storage engine which uses this
tablespace, with engine_name being the name of the storage engine. In
MySQL 5.1, engine_name must be one of the values NDB or NDBCLUSTER.
But you can tell MySQL which data- and index-dir to use for MyISAM, cf. http://dev.mysql.com/doc/refman/5.1/en/create-table.html:
By using DATA DIRECTORY='directory' or INDEX DIRECTORY='directory' you
can specify where the MyISAM storage engine should put a table's data
file and index file. The directory must be the full path name to the
directory, not a relative path.

InnoDB restore database is very slow

I have Mysql installed version 5.1.49-1ubuntu8.1 (with default InnoDB without any modification)
When using InnoDB, the mysqldump and read performance is comparable to MyISAM, but restore database is very slow.
When trying to install Drupal on blank database also take too long
Other than default-storage-engine = innodb, Is there anything I need to do before use InnoDB?
You should disable keys on the tables while restoring. This is the default behavior with the dumps generated from mysqldump. What is the command line you are using for dumping data?
You should dump the tables in the order of the primary key.

Missing InnoDb Engine

I just went to look over one my site's databases and noticed that all of the tables had been converted to MyISAM (they used to be InnoDB).
What's more is that InnoDB seems to missing, along with BerkeleyDB, Federated, and others.
A few months ago I upgraded from MySql 5.0 to 5.1.38. I can't imagine that I wouldn't have noticed if InnoDB was not installed after the upgrade, but maybe it's been that way since the upgrade. Having several 10 GB tables automatically convert themselves to MyISAM without hearing about any downtime seems very unlikely to me.
Regardless, the mysql system variable have_innodb is set to NO. Can I simply change that to YES or does that mean InnoDB is missing from the install?
Maybe InnoDB parameters were changed during upgrade? This advice from MySQL Forums helped me in a similar situation: http://forums.mysql.com/read.php?22,397052,408970
In short: Stop the MySQL daemon, delete ib_logfile* from datadir, restart MySQL.
If the field in SHOW ENGINES is "no" it means it's not compiled in. You would have to either compile the server again, compile the innodb plugin and load it or fetch server binaries which have it enabled.
You can't simply set the mysql system variable to YES to convert the table from MyISAM to InnoDB.
ALTER TABLE t1 ENGINE=InnoDB;
When InnoDB support is turned off even is you use ENGINE=InnoDB in your create table statements, the table will use the default storage engine for MySQL which is normally MyISAM.
It could also be the case that the innodb logfile[01] are corrupted. In which case the engine will show as disabled and the tables as ISAM. The log will mention it.