How do I set a schema level default engine? [MySQL] - mysql

I'm trying to set a default database engine for each of my MySQL schemas, but I can't seem to find out how to do that.
I know it's possible to specify the engine at the table level, and in the config file with --default-storage-engine=type, but isn't there a way to set it at the schema level?

No, you can set the engine to use in the CREATE TABLE statement, or you can set the default using the --default-storage-engine server startup option, or by setting the default-storage-engine option in the my.cnf configuration file. Finally you can set the default storage engine to be used during the current session by setting the storage_engine variable storage_engine.
There's no default schema storage engine.

Related

MySQL 5.1 InnoDB file-per-table option

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.

How to change default MySQL database/table default COLLATION using WampServer?

just want to ask about my problem. My problem is everytime I created a database. It's default collation is always set to 'latin1_swedish_ci'. But what I want is set this to 'utf8_general_ci' in DEFAULT. I also added this to my my.ini file in mysql:
character-set-server=utf8
collation-server=utf8_general_ci
But it is default in latin1_swedish_ci.
According to the manual, the my.ini is just about the only place where you cannot change this setting. You can either:
Change the startup parameters - pass ---character-set-server=latin1 etc. to the startup invocation.
Recompile with a different default - probably not really practical with WAMP
Change the values at runtime. This only changes them for the session though, and is as such rather pointless for these config values.
I'd look into option 1 for a local WAMP machine.

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.

How to change bdb cache size in mysql?

I would like to change variable bdb cache size (bdb_cache_size) on my mysql database to be able to import bigger SQL files (yes, i've set all other variables for example in php.ini to higher values and it does not work) in phpmyadmin.
How can I do that?
If you're really using BDB in your MySQL database, check you don't have skip-bdb in your my.cnf. Most installations disable it (and disable it this way) by default.
Berkeley DB is going away very soon in MySQL, so if you're using it, I'd recommend you shift to InnoDB (or at the very least MyISAM).