I am using MySQL 5.5 and trying to change they default storage engine for myself only. I tried creating a .my.cnf file in my home directory as per instructions I found here:
http://dev.mysql.com/doc/refman/5.5/en/storage-engine-setting.html
http://dev.mysql.com/doc/refman/5.5/en/option-files.html
You can see the changes I've made so far here:
selah@selah-OptiPlex-9020:~$ cat .my.cnf
[mysqld]
default-storage-engine=MyISAM
selah@selah-OptiPlex-9020:~$ sudo /etc/init.d/mysql restart
[sudo] password for selah:
* Stopping MySQL database server mysqld [ OK ]
* Starting MySQL database server mysqld [ OK ]
* Checking for tables which need an upgrade, are corrupt or were
not closed cleanly.
However MyISAM is still not the default!
mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)
How do I get this to work?
EDIT: For the record I was just able to get this working by editing my /etc/mysql/my.cnf file and restarting my COMPUTER (simply restarting the process failed). However I would still like to understand how to change this for my user only!
default_storage_engine
is a server setting, not a connection setting. The mysqld server doesn't read your user '~/.my.cnf', and clients only read the[client]
section, not the[mysqld]
section.You can change it via the
init-commend
in the[client]
section in '~/.my.cnf' though: