phpmyadmin convert myisam to innodb - mysql

Hey, so I have recently become aware that in order to do foreign key relationships, I need to convert my tables over to innodb. I was wanting to do this in phpmyadmin and found the option for 'storage engine (type)' However my dropdown of options is limited to: MyISAM, MEMORY, and MRG_MYISAM
Would anyone be able to explain why this is?
apache 2.0
phpmyadmin 3.3.10
mysql 5.0.67
php 5.2.2
Thanks!

InnoDB support has to be enabled on the instance of MySQL you're using.
Try issuing a SHOW ENGINES SQL command to see what's available.

Related

Possible to simulate mysql server in memory?

I wrote some functions that work with SQL. I test the functions using testthat and an in memory SQLite database. However, some functions cannot be tested using SQLite because SQLite does not support the ALTER TABLE command.
Is there some way to simulate a mySQL database in memory the same way that one can simulate a SQLite?
> DBI::dbConnect(RSQLite::SQLite(), ":memory:")
<SQLiteConnection>
Path: :memory:
Extensions: TRUE
> DBI::dbConnect(RMySQL::MySQL(), ":memory:")
Error in .local(drv, ...) :
Failed to connect to database: Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
If not, how does one write automatic tests for mySQL functions?
You can't make a whole MySQL instance run in memory like the SQLite :memory: option. MySQL is designed to be a persistent database server, not an ephemeral embedded database like SQLite.
However, you can use MySQL's MEMORY Storage Engine for individual tables:
CREATE TABLE MyTable ( ...whatever... ) ENGINE=MEMORY;
The equivalent in RMySQL seems to be the dbWriteTable() method, but as far as I can tell from documentation, you can't specify the ENGINE when creating a table with this method. You'll have to create the table manually in the MySQL client if you want to use the MEMORY engine.
But you should be aware that every storage engine has some subtle different behavior. If any of your tests depend on features of InnoDB, you won't be able to simulate them with the MEMORY storage engine (e.g. row-level locking, foreign keys, fulltext search).
Read the manual on the MEMORY storage engine: https://dev.mysql.com/doc/refman/5.7/en/memory-storage-engine.html
P.S.: Ignore the suggestions on that manual page to use NDB Cluster. It may be faster, but it requires multiple servers and special database design to achieve that performance. It's much harder to set up.

Enable InnoDB in MySQL

I want to use foreign key in MySQL. For that I needed to enable InnoDB feature. I have tried downloading latest version of MySQL Server from its official site.
I went through similar questions on stackoverflow but they addressed different issues.
I have tried editing all the .ini files and enabling InnoDB properties by removing # in front of corresponding properties.
Then I restarted MySQL and checked status of InnoDB from MySQL Client using query/
show engines;
It still shows InnoDB is disabled
I want to know steps of enabling the built in InnoDB feature for MySQL.
Here are the links to questions I visited:
Ques1
Ques2
Official MySQL forum
I am newbie in MySQL.
I will be very thankful for any help :-)
Check mysql log file. There could be some messages that may explain why InnoDB does not start. I suppose you don't have important InnoDB data. If so, try deleting ib_logfile0.xxx files and ibdata located in mysql data dir, then restart mysql to force those file to recreate. Also, check if innodb variables in my.cnf are properly configurated (For example, I have set memory for innodb_pool... to 1024G instead of 1024M, as a mistake).

Hibernate to use InnoDB instead of MyISAM

How do I get hibernate to use InnoDB instead of MyISAM when creating my tables? The suggestions at Hibernate: Create Mysql InnoDB tables instead of MyISAM are not working for me.
I am using Glassfish 3.1.2 and MySql 5. Also I have MySQL installed through XAMPP on Mac OSX Lion.
After much research, I learned that setting the database default to InnoDB is not good practice. A great number of reasons is given, such as InnoDB is expensive. In light of all the reasonings, I concluded that clearly if making InnoDB default was best practice then it's likely the database would come configured as such. So I kept looking for a different solution.
Anyway, the solution was this:
Go to glassfish and add the following properties to the JDBC connection pool in question.
Name: SessionVariables
Value: storage_engine=InnoDB.
This works for me like a charm.
If someone has a better solution, I would really love to hear it.

Changing the engine to InnoDB from MyISAM is not working

I am trying to change the table engine from MyISAM to INNODB. I am using the
alter table tablename ENGINE=INNODB
command. I am not getting any errors or warnings on the mysql side. I also commented the
skip-innodb
line in my.cnf file. So when I do a
show variables like 'have-innodb%'
it gives me a "YES". Also just to be on the safe side, I also deleted my ib_logfile0 and ib_logfile1 and restarted my mysql server.
But it still does not change the engine. I also did a show engines, and it shows innodb as one of the available engines.
Also these tables are full of data and have around 5000 rows, so is changing the engine type when a table has data, would that be the problem??
What could the missing link be??
Are you able to restart the server? If so, the error log will tell you if it had problems initialising the InnoDB engine.
Is this the first InnoDB table in your db? If so, you may have forgotten to create your ibdata files.
Does the table use fulltext indexing or other InnoDB-incompatible features?

Missing InnoDb Engine

I just went to look over one my site's databases and noticed that all of the tables had been converted to MyISAM (they used to be InnoDB).
What's more is that InnoDB seems to missing, along with BerkeleyDB, Federated, and others.
A few months ago I upgraded from MySql 5.0 to 5.1.38. I can't imagine that I wouldn't have noticed if InnoDB was not installed after the upgrade, but maybe it's been that way since the upgrade. Having several 10 GB tables automatically convert themselves to MyISAM without hearing about any downtime seems very unlikely to me.
Regardless, the mysql system variable have_innodb is set to NO. Can I simply change that to YES or does that mean InnoDB is missing from the install?
Maybe InnoDB parameters were changed during upgrade? This advice from MySQL Forums helped me in a similar situation: http://forums.mysql.com/read.php?22,397052,408970
In short: Stop the MySQL daemon, delete ib_logfile* from datadir, restart MySQL.
If the field in SHOW ENGINES is "no" it means it's not compiled in. You would have to either compile the server again, compile the innodb plugin and load it or fetch server binaries which have it enabled.
You can't simply set the mysql system variable to YES to convert the table from MyISAM to InnoDB.
ALTER TABLE t1 ENGINE=InnoDB;
When InnoDB support is turned off even is you use ENGINE=InnoDB in your create table statements, the table will use the default storage engine for MySQL which is normally MyISAM.
It could also be the case that the innodb logfile[01] are corrupted. In which case the engine will show as disabled and the tables as ISAM. The log will mention it.