Using a different MySQL database engine - mysql

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.

Related

How to change Federated MySQL storage engine to supported [duplicate]

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

Change default mysql storage engine using ~/.my.cnf

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;"

Install MariaDB Archive Engine

I have installed MariaDB on my Debian but Archive Engine is missing.
Is there any way how to install Archive Engine?
I haven't file ha_archive in my /usr/lib/mysql/plugin directory
Try to install plugin using SQL shell.
MariaDB> INSTALL PLUGIN archive SONAME 'ha_archive.so';
Show Plugins
MariaDB> show engines \G
EDIT:
I have installed mariadb-10.x on ubuntu and ARCHIVE is by default enabled.
MariaDB> show engines \G
*************************** 7. row ***************************
Engine: ARCHIVE
Support: YES
Comment: Archive storage engine
Transactions: NO
XA: NO
Savepoints: NO
I fixed this by entering the following command in MariaDB by logging as a root user -
MariaDB [(none)]> INSTALL SONAME 'ha_archive';
Query OK, 0 rows affected (0.33 sec)
Check if it is installed -
MariaDB [(none)]> 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 |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| SEQUENCE | YES | Generated tables filled with sequential values | YES | NO | YES |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| InnoDB | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, foreign keys and encryption for tables | YES | YES | YES |
| Aria | YES | Crash-safe tables with MyISAM heritage | NO | NO | NO |
+--------------------+---------+--------------------------------------------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)

Table type CSV dont created

I created a table type CSV but in PHPMyAdmin was created table with type MRG_MYISAM.
I read https://dev.mysql.com/doc/refman/5.1/en/csv-storage-engine.html
To enable the CSV storage engine if you build MySQL from source,
invoke configure with the --with-csv-storage-engine option.
Is it possible other methods to include this type ? Maybe my.ini ....
In order to know what storage engines are available you can run the following query:
show engines
The output will look like this:
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| MyISAM | YES | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| 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 |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
As the documentation you've read explains, it's possible to decide on compilation time whether the MySQL binaries will include support for the CSV engine. If they don't, it's just not possible to use it. You cannot enable something that doesn't exist ;-)

change default mysql storage engine on Ubuntu

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