You are here
John Maxim - Sun, 2009/08/30 - 18:19
I have been trying to figure out if I need to change my.cnf to enable INNODB from the LAMP appliance I have installed..
Any advice how to make it enabled? or alter the tables into INNODB instead of MyISIAM?
Currently I have set up some tables in MyISIAM. . .as I tried using INNODB - it generates error message. .
Thanks.
leow
Forum:
Tips using InnoDB
Secondly, I have found that the innodb logfiles constantly get corrupted when the mysql service shuts down. An ugly (but useful) hack is to remove the logfiles when starting the service: Note: I have not used this hack in a production environment, but in my testing it works without any unforeseen issues.
Hi, Alon, this is what I got.
Hi, Alon, this is what I got. .
root@lamp:~# sed -i s"| 'start')| 'start')
> rm -f /var/lib/mysql/ib_logfile*|" /etc/init.d/mysql
sed: -e expression #1, char 21: unterminated `s' command
root@lamp:~#
It is still not working...
P.S. I am still a newbie, I know I have typed wrongly but not knowing exactly what was wrong, please anyone help to correct the hacks I entered..
The newline is being interpreted by your shell
The easiest way would be to manually edit /etc/init.d/mysql, and add this after 'start') Don't forget to specify the default storage engine (see mentioned post for details).
And ofcourse, /etc/init.d/mysql restart after your changes.
So, I went on to do
So, I went on to do these:
root@lamp:~# /etc/init.d/mysql stop
* Stopping MySQL database server mysqld [ OK ]
root@lamp:~# mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile0.bak
root@lamp:~# mv /var/lib/mysql/ib_logfile1 /var/lib/mysql/ib_logfile1.bak
root@lamp:~# /etc/init.d/mysql start
* Starting MySQL database server mysqld [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.
root@lamp:~# mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
root@lamp:~# show engines
-bash: show: command not found
root@lamp:~# cat /etc/mysql/conf.d/storage_engine.cnf
cat: /etc/mysql/conf.d/storage_engine.cnf: No such file or directory
root@lamp:~# /etc/init.d/mysql restart
* Stopping MySQL database server mysqld [ OK ]
* Starting MySQL database server mysqld [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.
===
I still can't create tables with engine INNODB...
the specified commands where exemplary
The specified commands where exemplary, when you receive an error, stop and try figure out why.
A couple of notes:
Here is how I have placed the
Here is how I have placed the code manually:
# ugly hack for innodb logfile corruption
rm -f /var/lib/mysql/ib_logfile*
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $remote_fs $syslog mysql-ndb
# Required-Stop: $remote_fs $syslog mysql-ndb
# Should-Start: $network $named $time
# Should-Stop: $network $named $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the mysql database server daemon
------
It doesn't help..any way I have been trying to create the file storage_engine.cnf.. How do I create that? Do I just create a blank file named storage_engine.cnf?
Clarifications
when I referred to start, i didn't mean at the "start" of the file, but rather after the 'start') code - it should look something like this:
Regarding storage_engine.cnf, you can use your favourite editor (vim, nano, etc.) to create the file, or just do this:
BTW, why do you want to use InnoDB in the first place??
Hi Alon, thanks but about
Hi Alon, thanks but about creating the storage_engine.cnf..
I have followed exactly as you have written, however in the file I will have only one line which is:
default-storage-engine = InnoDB
I doubt that is right as I restart mysql, the error I received is:
root@lamp:~# /etc/init.d/mysql restart
* Stopping MySQL database server mysqld error: Found option without preceding group in config file: /etc/mysql/conf.d/storage_engine.cnf at line: 1
error: Found option without preceding group in config file: /etc/mysql/conf.d/storage_engine.cnf at line: 1
[ OK ]
error: Found option without preceding group in config file: /etc/mysql/conf.d/storage_engine.cnf at line: 1
* Starting MySQL database server mysqld error: Found option without preceding group in config file: /etc/mysql/conf.d/storage_engine.cnf at line: 1
error: Found option without preceding group in config file: /etc/mysql/conf.d/storage_engine.cnf at line: 1
error: Found option without preceding group in config file: /etc/mysql/conf.d/storage_engine.cnf at line: 1
[ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.
**
About why I use InnoDB, I thought that's how we need to create tables which involve foreign keys..
missing [mysqld]
It works in MySQL > show engines; But not phpMyAdmin > Storage..
It works in MySQL > show engines;
I can see my default engine now is INNODB.
But not in:
phpMyAdmin > Storage engines
Default engine is still MyISIAM.
In short, it doesn't work when I try creating INNODB engine table.
After went through all the changes I now can't even create MyISIAM table in phpMyAdmin.
Like I asked earlier, shouldn't we do something with my.cnf?
Hi Alon, sorry for me being
Hi Alon, sorry for me being desperate and unknowlegeable in Linux..
Thanks for your help this far although I still can't seem to find any solutions to this..
No problem, just keep...
You are right that you need to edit my.cnf, which is what we did although indirectly. my.cnf imports all configuration in /etc/mysql/conf.d/
I'm out of tips, so I will need to perform the changes locally and see if I can replicate the issues you are having. I'll try get to it later in the day and report back my findings...
Thank you..
Just Thank you..
Steps to enabled InnoDB as default storage engine
Ok, so I found some time to do some testing, and have sketched out the exact steps I used to enable InnoDB as the default storage engine of MySQL.
Please note the GOTCHA in the PHPMyAdmin section.
Steps to enabled InnoDB as default storage engine
Stop MySQL
Ugly hack for innodb (logfiles constantly get corrupted)
Start MySQL
Display supported/default engines
Configure default storage engine
Restart mysql for changes to take effect
Display supported/default engines
Testing with PHPMyAdmin
Connect to phpmyadmin with your browser: https://appliance_ip:12322 Click "storage engines" -> "InnoDB" This will display InnoDB's configuration and that it is the default storage engine GOTCHA: Do not be confused by the description of MyISAM MyISAM Default engine as of MySQL 3.23 with great performance It is just the description, it is not the engine status Create a test database with test tables, notice that the default is InnoDB.
Enjoy!
It probably has already been working since my last post. . :)
I was just overly desperate or something..
I noticed that you are definitely right there wasn't much new things in your latest post - just that I didn't know how to read description and status they are 2 different thing. :)
Yes, now it works. I imported INNODB tables and it works.
Thank you, Alon.
Better solution for innodb logfiles
In my previous post I recommended using an ugly hack to remove the innodb logfiles pre mysql start as they "contantly get corrupted".
In theory, this should not happen and if it does the sysadmin should remedy the problem by shutting down mysql (without errors), manually remove the logfiles and restart mysql to avoid data loss.
I hacked together a patch to the mysql init script to be a little less forceful. It only takes into account the default innodb configuration, so if you tweaked it this might not work for you.
My patch is in bold:
Hi Alon, I don't even know
Hi Alon, I don't even know where to begin. See, I'm 'still' dumb with Linux. Maybe I need more time practising .. but college has been busy with -non-linux assignments.
Keep updating, thank you very much..
By the way, if I SSH through any of Turnkey appliance, and use apt-get update from there, is it the correct way to do so? or is it automatically updated?
Thanks.
Add new comment