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:
init-command="SET default_storage_engine=MYISAM;"
Related
I have mysql 5.1.44:
mysql> show engines;
+------------+---------+
| Engine | Support |
+------------+---------+
| ndbcluster | NO |
| MRG_MYISAM | YES |
| BLACKHOLE | YES |
| CSV | YES |
| MEMORY | YES |
| FEDERATED | NO |
| ARCHIVE | YES |
| InnoDB | YES |
| MyISAM | DEFAULT |
I need to enable federated engine in mysql. How can I do it?
Edit /etc/my.cnf and in the [mysqld] section, add the line:
federated
It's equivalent to specifying --federated on the command line
I know the post is a little old, but it seems that many people are having issues with federated engines.
When the mysql binaries are installed via yum, you already have the HA (High Availability) plugins. You simply need to load the plugins within the mysql CLI.
Here is the basic process:
Start mysqld if it is not already started. Make sure 'federated' is NOT in /etc/my.cnf at this point.
EX: At this time, /etc/my.cnf will look like this from a standard YUM install....
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Log into the mysql CLI with root (or another account with sufficient privilege).
Type: show engines;
You should see no FEDERATED engine at this point, like this:
mysql> show engines;
+------------+---------+------------------------------------------------------------+--- -----------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--- -----------+------+------------+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
5 rows in set (0.00 sec)
--> END PASTE <--
To enable the federate engine, type the following:
install plugin federated soname 'ha_federated.so'
NOW, when you 'show engines' you will see the FEDERATED Engine, but turned off...
It will look like this:
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
6 rows in set (0.00 sec)
You can now safely add the line 'federated' to the /etc/my.cnf file like this:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
federated
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Restart mysqld (service mysqld restart, etc...)
After the restart, go back in to the mysql CLI.
Type 'show engines;'
You should now see the FEDERATED Engine available and with SUPPORT as YES.
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| FEDERATED | YES | Federated MySQL storage engine | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
6 rows in set (0.00 sec)
And you are done...go forth and create federate tables...
Good luck!
Beginning with MySQL 5.0.64, the
FEDERATED storage engine is not
enabled by default in the running
server; to enable FEDERATED, you must
start the MySQL server binary using
the --federated option. — MySQL Documentation
To use the --federated option in a configuration file drop the --.
Example
my.cnf
[mysqld]
federated
I was trying Foward Engineer in Workbench and this error appeared to me, so my solution was, Workbench -> Load your Model -> Mysql Model -> click in the table that was showing the error, and click on Edit, after that just change Engine to InnoDB.
MYSQL 8
I have a huge issue trying to solve it for a few hours. I installed, configured and ran the mysql-cluster but when I want to create a table I get the following issue:
create table simples (id int not null primary key) engine=ndb;
ERROR 157 (HY000): Could not connect to storage engine
I changed my my.cnf file like this :
[mysqld]
ndbcluster
ndb-connectstring=host:port
datadir=/home/user/my_cluster/mysqld_data
basedir=/home/user/mysqlc
port=5018
I tried again to create tables but I have still the error.
[my_cluster]# /home/user/mysqlc/bin/mysql -h 127.0.0.1 -P
5018 -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.6.15-ndb-7.3.4-cluster-gpl MySQL Cluster Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Also I executed this command to check all engines status but everything is fine :
show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| ndbcluster | YES | Clustered, fault-tolerant tables | YES | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| ndbinfo | YES | MySQL Cluster system information storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
11 rows in set (0.00 sec)
What this means is simply as it says, one SQL node is not connected to the NDB storage engine. It can be that you have messed up the ndb-connectstring in the my.cnf of that SQL node.
It is often the case that someone has been doing ALTER TABLEs, and for some reason, the schema files have been corrupted or is of the wrong version on one or more SQL nodes. It would make sense to check the SQL nodes for potential problems there.
The other possibility is that it could be an issue with your firewall. I would recommend you check your firewall and /etc/hosts tables.
If you have previously installed another mysql-server package, make sure you delete all your old config files and folders.
I've installed mysql 5.1.49 on Ubuntu. I've added the following line to the end of /etc/mysql/my.cnf
default-storage-engine=innodb
I've restarted the mysqld process, then run
mysql> show engines;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
As you can see MyISAM is still the default, what am I missing? I've also run
sudo find / -name 'my.cnf'
to verify that there is no other my.cnf file present on the system
It's probably in the wrong section of the my.cnf file.
You need to set that variable in the [mysqld] section. If you put it at the end of the config file, it's probably in a different section, since [mysqld] is typically the first section, not the last.
Verify that you have put default-storage-engine=innodb in the appropriate [group], usually [mysqld].
I am trying to make Innodb as my default engine and I changed this in the my.cnf file.
I set default-storage-engine=InnoDB in my.cnf file and restarted mysql but still it's not taking it.
Even after restarting the server, it's still showing default engine as MyISAM.
show engines
+------------+---------+-
| Engine | Support |
+------------+---------+-
| InnoDB | YES |
| MRG_MYISAM | YES |
| BLACKHOLE | YES |
| CSV | YES |
| MEMORY | YES |
| FEDERATED | NO |
| ARCHIVE | YES |
| MyISAM | DEFAULT |
+------------+---------+-
How can I change it to InnoDB ?
Make sure you add this line in the proper section of the my.cnf file. It needs to be in the [mysqld]section:
default-storage-engine=InnoDB
Also, comment out any other line in my.cnf that may be setting it to MyISAM.
I am having problems trying to use a different MySQL database engine. (I want to change from MyISAM to InnoDB)
/etc/my.cnf
[mysqld]
bind-address = 127.0.0.1
default-storage-engine=InnoDB
It appears that it is not installed? If that is true, how can I install InnoDB?
mysql> show engines;
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
| CSV | YES | CSV storage engine | 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 |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
4 rows in set (0.00 sec)
I am on Mac OS 10.5 and I am using MySQL version 5.1.35.
See here
http://dev.mysql.com/doc/refman/5.1/en/pluggable-storage.html
You'll need to locate download the appropriate build of the InnoDB plugin.