Error: Mysql database doesn't support transactions - mysql

Hi I have a InnoDB has a default database which supports transactions.
But When I run transactions script for Mysql sql-benchmarking I get below error:
Testing server 'MySQL 5.5.29 0ubuntu0.12.10.1' at 2013-02-11 11:32:28
Test skipped because the database doesn't support transactions
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 |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
I have edited my.cnf adding default-engine Innodb. but still no luck.
The perl script is "test-transaction" in Mysql Sql bench...
###
### Test insert perfomance
###
test_insert("bench1","insert_commit",0);
test_insert("bench2","insert_autocommit",1);
sub test_insert
{
my ($table, $test_name, $auto_commit)= #_;
my ($loop_time,$end_time,$id,$rev_id,$grp,$region);
$dbh->{AutoCommit}= $auto_commit;
$loop_time=new Benchmark;
for ($id=0,$rev_id=$opt_loop_count-1 ; $id < $opt_loop_count ;
$id++,$rev_id--)
{
$grp=$id/$opt_groups;
$region=chr(65+$id%$opt_groups);
do_query($dbh,"insert into $table values ($id,$rev_id,'$region',$grp,0)");
}
$dbh->commit if (!$auto_commit);
$end_time=new Benchmark;
print "Time for $test_name ($opt_loop_count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
}

Related

Aurora Serverless MySQL Gives "Index Column Size Too Large" Despite Proper Settings

I'm trying to add an index to an existing table as part of the upgrade process for Invision Community forums. The database is hosted in AWS Aurora Serverless, which has MySQL 5.6 compatibility. However, every time, I receive the error:
ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes.
Here are the details about the table and the schema:
+---------------+--------+---------+------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+--------------------+----------+--------------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+---------------+--------+---------+------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+--------------------+----------+--------------------+---------+
| ibf_core_tags | InnoDB | 10 | Dynamic | 36862 | 299 | 11026432 | 0 | 13189120 | 4194304 | 95183 | NULL | NULL | NULL | utf8mb4_unicode_ci | NULL | row_format=DYNAMIC | |
+---------------+--------+---------+------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+--------------------+----------+--------------------+---------+
+--------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+--------------+------+-----+---------+----------------+
| tag_id | bigint(20) | NO | PRI | NULL | auto_increment |
| tag_aai_lookup | char(32) | NO | MUL | | |
| tag_aap_lookup | char(32) | NO | MUL | | |
| tag_meta_app | varchar(200) | NO | MUL | | |
| tag_meta_area | varchar(200) | NO | | | |
| tag_meta_id | int(10) | NO | | 0 | |
| tag_meta_parent_id | int(10) | NO | | 0 | |
| tag_member_id | int(10) | NO | MUL | 0 | |
| tag_added | int(10) | NO | MUL | 0 | |
| tag_prefix | int(1) | NO | | 0 | |
| tag_text | varchar(255) | YES | | NULL | |
+--------------------+--------------+------+-----+---------+----------------+
Default charset for the table is utf8mb4 and the innodb_large_prefix setting is ON.
The operation I'm trying to do is:
ALTER TABLE `ibf_core_tags` ADD KEY `tag_text` (`tag_text`(191));
I would think 191 * 4 = 764, which is less than the 767 byte value it says I'm exceeding. Is this a bug in Aurora Serverless? Is there a way around this issue? I've tried changing the table to MyISAM to add the index, but I actually get the same error when I try that.
Using a local install of MySQL 5.6, I was able to run this ALTER TABLE query on the same database, so I'm not sure why Aurora Serverless is any different.
I ended up trying this on a non-serverless Aurora instance and had that same issue.
I had this same issue with a Slim PHP project using Laravel for the DB connections. By default, AWS Aurora Serverless is using the file format of Antelope which defaults to the row format of COMPACT. We need a file format of Barracuda and a row format of DYNAMIC in order to allow large index key prefixes (reference).
I created a custom Parameter Group and explicitly set the following parameters:
innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_large_prefix = 1
These params are allowed to be set according to AWS's Aurora Serverless documentation.
Setting these params didn't fix the issue by itself though. Tables were still being created with a row format of COMPACT. In the DB connection params I also had to set 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC' (reference). This syntax is for Laravel but hopefully it points others in the right direction as I just spent a whole afternoon figuring it out :)

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

Using a different MySQL database engine

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.